Boost logo

Boost :

Subject: Re: [boost] [local] Simplifying the parenthesized syntax
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-02-13 22:13:45


[Lorenzo Caminiti]
> Why C++0x lambdas don't support constant binding?

> Constant binding is instead supported by Boost.Local. I looked over
> N2550, N2529, etc but I could only see binding by value and reference
> and not by constant value and constant references?! I must be missing
> something...

By default, lambdas' function call operators are const, so variables captured by copy can't be modified. Of course, this doesn't affect variables captured by reference.

N3225 5.1.2 [expr.prim.lambda]/5: "This function call operator is declared const (9.3.1) if and only if the lambda-expression's parameter-declaration-clause is not followed by mutable."

Stephan T. Lavavej
Visual C++ Libraries Developer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk