Monthly Archives: May 2017

Syntax [crayon-5dab105e31bf6570628610/] constexpr Before discussing about if-constexpr, we should discuss first about constexpr. It was introduced in C++11 to mark an expression as having a compile-time constant result. More about constexpr can be read here. if-constexpr if-constexpr simply add if statements at compile time. This way, we can get rid […]

Language feature: Compile-time if statement / if-constexpr

Syntax [crayon-5dab105e332c9534722990/] Usage / Usability Guarantees initialization at compile-time Used as a function qualifier before the function’s return type Conceptually, constexpr indicates a value that’s not only constant, it’s known during compilation. constexpr functions produce:compile-time constants (when they are called with compile-time constants) Runtime values (when they are called with […]

General features: constexpr