Note: This paper was adopted into draft C++14 on Saturday at the Bristol UK ISO C++ meeting.
A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N3649
Date: 2013-04-19
Generic (Polymorphic) Lambda Expressions (Revision 3)
by Faisal Vali, Herb Sutter, Dave Abrahams
Excerpt:
This document revises wording for generic lambda expressions as described in N3559: Proposal for Generic (Polymorphic) Lambda Expressions (Revision 2) and as approved by EWG and which should be referenced for further detail. Today’s C++11 lambda expression concisely creates an instance of a class having a non-template function call operator. We propose a pure extension of C++11 lambda syntax that creates an instance of a class having a function call operator template.
Here follow some examples of the proposed syntax extension in use:// 'Identity' is a lambda that accepts an argument of any type and // returns the value of its parameter. auto Identity = [](auto a) { return a; }; int three = Identity(3); char const* hello = Identity("hello"); // Conversion to function pointer for capture-less lambdas int (*fpi)(int) = Identity; char (*fpc)(char) = Identity;
Add a Comment
Comments are closed.