If we look at the draft draft C ++ 5.1.2 lambda expressions in paragraph 2 say (emphasis mine forward):
Evaluation of a lambda expression leads to a temporary assignment (12.2). This temporary is called a closing object. A lambda expression should not appear in an unpublished operand (section 5). [Note. The closing object behaves like a function object (20.8) .- End note]
and section 5.19 The constant expressions given in paragraph 2 say:
A conditional expression is an expression of a basic constant if it does not include one of the following: a potentially evaluated subexpression (3.2), but a subexpression of logical AND (5.14), logical OR (5.15), and conditional (5.16) operations that are not evaluated, are not are considered [...]
and has the following brand:
- lambda expression (5.1.2);
So why are lambdas expressions not allowed in the unvalued operand but allowed in the unvalued parts of constant expressions?
I see how for inexperienced operands type information in several cases ( decltype or typeid ) is not very useful, since each lambda has a unique type. Although why do we want to resolve them in an invaluable context of constant expression, is it unclear, perhaps, for SFINAE ?
c ++ lambda c ++ 11 c ++ 14 constant-expression
Shafik Yaghmour Mar 6 '14 at 17:49 2014-03-06 17:49
source share