C++

C++26: std::constant_wrapper -- Sandor Dargo

Sandor Dargo explains std::constant_wrapper and its shorthand std::cw, a C++26 utility for keeping compile-time values constant across function boundaries. In current C++, a constexpr value passed as a function parameter is no longer a constant expression inside the function body, forcing workarounds such as template parameters, tag types or std::integral_constant. The feature, from P2781R9 by Hana Dusíková, Matthias Kretz and Zach Laine and refined by P3978R3, wraps any structural type as a non-type template parameter and supports compile-time arithmetic and function calls.

AI-written summary, checked against the cited sources. How summaries work

Read at isocpp.org