Apr 15, 2012

[c++11][NOTE] lambda & decltype

Tried this before.

Here's the memo from stackoverflow:
Lambda expressions as class template parameters

The evaluation of a lambda-expression results in a prvalue temporary (12.2). This temporary is called the closure object.

A lambda-expression shall not appear in an unevaluated operand (Clause 5).

The result of the lambda expression is an object, but the logic is in an ordinary function (rather than a member function). And the object decays to a pointer to this ordinary function.
(That is, which means, no "this signature" inside the operator() function.)

If non-capturing , it's just a function:
section 5.1.2, paras 1, 2, and 6. p1 and p2 explain that lambdas create function objects (functors). p6 says that a non-capturing lambda corresponds to an ordinary free function (enabling it to be stored in an ordinary function pointer).

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.