【发布时间】:2016-03-29 10:48:44
【问题描述】:
这些成员变量有什么区别:
struct my_class {
static const int i = 0;
static constexpr int j = 0;
};
如果我的理解是正确的,我可以同时使用i 和j 作为编译时常量。也就是说,std::array<int, my_class::i> 和 std::array<int,my_class::j> 都应该可以工作。
【问题讨论】:
-
读完那个问题后,我还是想不出我的问题的答案:-)
-
@HumamHelfawi 我想知道当 constexpr 为静态时它有什么不同。这有点不同。
标签: c++ templates c++11 c++14 constexpr