← Back to context

Comment by tialaramex

9 hours ago

> Since C++20 you can use constinit, or std::construct_at to avoid static initialization woes entirely

This is just yet another bad defaults situation. Yes, that's the correct behaviour and so it's what Rust's statics do, but it wasn't how C++ worked so they had to add this constinit keyword. LazyStatic is solving the other thing - where we don't need runtime parameters but we are doing work at runtime so we aren't truly constant.