...

/

std::is_constant_evaluated Library in C++20

std::is_constant_evaluated Library in C++20

Understand the details of 'std::is_constant_evaluated' with an example.

We'll cover the following...

The function std::is_constant_evaluted determines whether the function is executed at compile time or run time. Why do we need this function from the type-traits library? In C++20, we have roughly spoken of three kinds of functions:

  • consteval declared functions run at compile time: consteval int alwaysCompiletime();

  • constexpr declared functions can run at compile time or run time: constexpr int ...