At the moment, we have two primary options for compile-time evaluation: template metaprogramming (generally using template structs and/or variables), and constexpr
constexpr
C++20 added consteval for this express purpose. A consteval function is a constexpr function that is guaranteed to be only called at compile time.
consteval