constinit
Requires a static variable to be initialised at compile time (C++20), avoiding the static initialisation order fiasco.
Advanced
constinit int retries = 3; — the variable can still change later.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.