ISO/IEC JTC1 SC22 WG21 N3052 = 10-0042 - 2010-03-09
Lawrence Crowl, email@example.com, Lawrence@Crowl.org
Alisdair Meredith, firstname.lastname@example.org
This paper is updated from N3043 = 10-0033 which extracts a generally uncontroversial portion of N2989 = 09-0179.
The semantics of a lambda with an empty capture list and a function are nearly uniform. This uniformity was noted in U.K. national body comment 226. Exposing this uniformity would allow programmers to use lambdas and exploit existing function-based interfaces.
Problem: A lambda with an empty capture list has identical semantics to a regular function type. By requiring this mapping we get an efficient lambda type with a known API that is also compatible with existing operating system and C library functions.
Resolution: Add a new paragraph: "A lambda expression with an empty capture set shall be convertible to pointer to function type R(P), where R is the return type and P is the parameter-type-list of the lambda expression." Additionally it might be good to (a) allow conversion to function reference and (b) allow extern "C" function pointer types.
We adopt the suggested resolution.
The proposed wording shows changes from working draft N3035.
Add a new paragraph after paragraph 5. The intent of this edit is to obtain a closure-to-function-pointer conversion for a lambda with no lambda-capture.