c++ constexpr

#include<iostream>
using namespace std;
//constexpr 是更严格的定义只读变量,其要求该变量的初始化值必须是字面值常数(在未来版本可能扩展为也可以用其他只读变量初始化)

int main()
{
    const int a =10;
    const int b = a;

    constexpr int c =10;
    int e =10;
    constexpr int d = e;
}
posted @ 2016-03-30 10:28  夜色下的港湾  Views(123)  Comments(0Edit  收藏  举报