From Jason Turner
Watch on YouTube

Summary

This episode introduces C++20's consteval keyword, which enforces that a function must be evaluated at compile time. Jason explains that consteval is similar to constexpr but more restrictive, as it guarantees immediate compile-time evaluation rather than permitting both compile-time and runtime evaluation. He demonstrates how consteval functions fail to compile when used with non-constant expressions and discusses practical applications, including std::source_location from the standard library.

Resources

Tags