Monthly Archives: May 2017


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