Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, in C++17, lambda expressions can be evaluated as constexpr under certain conditions. According to the C++17 standard, a lambda expression can be constexpr if:

  1. The lambda body contains only the allowed statements and expressions that are allowed in a constexpr function.
  2. The lambda captures do not include this, correferenced variables, or variables with non-literal types.
  3. The lambda has no mutable or volatile qualifier.

If these conditions are met, the lambda can be declared as constexpr and evaluated at compile time.