在像这样的代码中:
#include <iostream>
template<int I>
struct A {
static constexpr int I1 = I + 1;
static constexpr int I2 = I1 + 1;
};
int main() {
std::cout << A<1>::I1 << " " << A<1>::I2 << std::endl;
}
可以安全地假设I2
会被正确初始化,也就是说I1
会在I2
之前被初始化吗?