const Vs constexpr
With C++11, WG21 comity introduced generalized constant expression to be able to use in C++ as compile time evaluated constants, and only be used on where its value is evaluated to a const expression. It should have the following requirements: As a Variable: it must be immediately constructed or assigned a value. the constructor parameters or the value to be assigned must contain only literal values, constexpr variables and functions. the constructor used to construct the object (either implicit or explicit) must satisfy the requirements of constexpr constructor. In the case of explicit constructor, it must have constexpr specified. As a Function: it must not be virtual its return type must be LiteralType each of its parameters must be literal type the function body must be either deleted or defaulted or contain only the following: null statements static_assert declarations typedef declarations and...