Generalized lambda-captures
Section [expr.prim.lambda.capture]
John Freeman

Created on 2008-12-11.00:00:00 last changed 125 months ago


Date: 2014-03-03.00:00:00

Rationale, March, 2009:

This idea was discussed and rejected by the EWG.

This issue was addressed by the adoption of N3648, adopted at the April, 2013 (Bristol) meeting.

Date: 2022-11-20.07:54:16

In the current specification of lambda expressions, a name appearing in a lambda-capture must refer to a local variable or reference with automatic storage duration (7.5.5 [expr.prim.lambda] paragraph 3). This restriction seems unnecessary and possibly confusing.

One possibility would be to extend the syntax of the lambda-capture to be something like

v = expr

with the meaning that the closure object would have a member named v initialized with the value expr. With this extension, the current syntax could be viewed as an abbreviation for

v = v
Date User Action Args
2014-03-03 00:00:00adminsetstatus: extension -> cd3
2009-03-23 00:00:00adminsetmessages: + msg2035
2009-03-23 00:00:00adminsetstatus: open -> extension
2008-12-11 00:00:00admincreate