From Jason Turner
Watch on YouTube

Summary

This episode explores C++23's new 'if consteval' feature, comparing it to C++17's 'if constexpr' and C++20's 'std::is_constant_evaluated()'. Jason explains that while 'if constexpr' is for template metaprogramming with different code paths, 'std::is_constant_evaluated()' determines at runtime whether code is being executed during constant evaluation. The new 'if consteval' feature provides a cleaner, more concise syntax for the common use case of checking for constant evaluation context without the verbose and potentially confusing 'if (std::is_constant_evaluated())' pattern.

Resources

Tags