constinit Questions

2

Solved

constinit is a new keyword and specifier in C++20 which was proposed in P1143. The following example is provided in the standard: const char * g() { return "dynamic initialization"; } constexpr c...
Smedley asked 8/9, 2019 at 19:31

1

Solved

Generally it is said that the destructors of static objects are called in the reverse order of the constructors. As I understand, constinit objects are initialized at compile time, so their destruc...
Doublespace asked 16/7, 2020 at 5:40

1

Solved

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-fo...
Frail asked 18/6, 2020 at 7:22
1

© 2022 - 2024 — McMap. All rights reserved.