Monthly Archives: May 2017

Syntax [crayon-5cb9e7185badc135943194/] 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-5cb9e7185d6bf675544940/] 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