constexprand Constant Expressions
A constant expression is an expression whose value cannot change and that can be evaluated at compile time. A literal is a constant expression. A
const object that is initialized from a constant expression is also a constant expression. As we’ll see, there are several contexts in the language that require constant expressions.
Whether a given object (or expression) is a constant expression depends on the types and the initializers. For example:
const int max_files = 20; // max_files is a constant expressionconst int limit = max_files + 1; // limit is a constant expressionint staff_size = 27; // ...