With the new C++11 standard, when should I use the inline
keyword over the constexpr
keyword? Does the constexpr
keyword offer any additional optimization over inline
, or does it merely assert that things must be computed at compile-time?
Why does constexpr
work on the GCC in some cases where the call is not constant, such as calling foo(x)
on a non-constexpr
variable? Is this a bug in the GCC or is it actually part of the standard?
constexpr
functions are not used in a context requiring a constant expression, the compiler is not obligated to compute the expression at compile-time. – Cribble