constexpr int f() { return 0; }
int g() { return 0; }
constexpr auto c1 = f(); // OK
constinit auto c2 = f(); // OK
constexpr auto d1 = g(); // ill-formed
constinit auto d2 = g(); // ill-formed
int main() {}
如上面的代码所示,我找不到constinit和之间的任何区别constexpr。
constinit和之间的真正区别是constexpr什么?
更新:
相关的 C++20 中有什么?constinit没有明确说明 和 之间的constinit区别constexpr。