Explain what consteval and constinit bring to C++?
Show answer and explanation
consteval makes a function immediate so evaluated calls must be constant expressions. constinit guarantees static initialization for a static- or thread-storage object but does not add constness.
consteval makes a function immediate so evaluated calls must be constant expressions. constinit guarantees static initialization for a static- or thread-storage object but does not add constness.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.