这些成员变量有什么不同:
如果我的理解是正确的,我可以使用 i 和 j 作为编译时常量。也就是说,
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>
都应该可行。
constexpr
andconst
的重复问题。 - Humam Helfawi