
13 Jan
2009
13 Jan
'09
12:14 p.m.
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.