Monthly Archives: May 2017


code
Syntax [crayon-5d5e8b9846c05483480436/] 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



code
Syntax [crayon-5d5e8b984817d491265606/] 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