Compile-Time Magic: C++23’s std::expected and the Limits of Compile-Time Computation
Today, let’s talk about a “black magic” tool brought by C++23—std::expected. It is not just an upgraded version of error handling; it can perfectly combine with compile-time computation (constexpr), allowing you to handle “expected values” or “unexpected errors” at the compilation stage. Imagine calculating complex expressions during code compilation, returning error messages directly if something … Read more