Boost logo

Boost :

Subject: Re: [boost] [scope_exit] Doesn't included in Boost yet?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-01-13 07:14:32


Alexander Nasonov wrote:
> Mathias Gaunard <mathias.gaunard <at> ens-lyon.org> writes:
>
>> Except C++0x lambdas are only monomorphic for now.
>
> Can you be more specific?
> In my example '[&a, b]() -> void { /* … */ }', is there is any restriction
> on a and b (e.g. thay can't be deduced names)?

The restriction isn't on variables you can capture, but on the types of
the arguments.

You may not write [&](a) { return a + 42; }
You have to write
[&](SomeType a) { return a + 42; }

Boost.Lambda or Boost.Phoenix will however allow you to write
_1 + 42
which is polymorphic.

I don't really know about ScopeExit, but it can surely do polymorphic
just as well.


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