On Tue, Aug 18, 2009 at 1:58 PM, Robert Jones
On Tue, Aug 18, 2009 at 6:10 PM, Michael Caisse
wrote: Robert Jones wrote:
2009/8/18 Björn Karlsson
mailto:Bjorn.Karlsson@readsoft.com> 2) Use Boost.Lambda's bind() and dereference the placeholder directly in the bind expression.
for_each(vec.begin(), vec.end(), bind(&foo, *_1));
Much as I like Lambda for virgin code, in my work code base there's a very visible inclusion of Boost.Bind, with placeholders in the global namespace. I've concluded that the pain of clashing placeholders just isn't worth it, so I steer clear of Lambda now.
Thanks Bjorn.
- Rob.
Rob -
Let me suggest Boost.Phoenix. Phoenix is an amazingly powerful library that will handle all of your bind and lambda needs. You also wont suffer from the plagued global namespace fiasco by mixing Boost.Bind and Boost.Lambda.
Ah, yes, Phoenix......
I'm never sure of the status of Phoenix - it's not listed as a first class library in the documentation, but buried inside the Spirit docs, and I understand that's about to change. So will all the #include paths change, or indeed some aspects of the functionality?
It should not I would think. Phoenix2 (phoenix in spirit, the old phoenix is phoenix1, ignore it) is heavily used by the very latest Spirit2.1 codebase, and spirit tends to always include forwarding headers as things move around anyway.