"Kevin Wheatley"
David Abrahams wrote:
And unless Boost.Lambda has been updated since I looked, there are some nice things that Boost.Bind handles automatically, like calling through smart pointers, that aren't quite so easy with Boost.Lambda.
I tried recently to use containers of smart pointers (boost::shared_ptr) and ran into a real mess of error messages (VC++ 7.1), even though I was doing a 'simple' std::find_if() with a _1 == value test.
When I had simple pointers Boost.Lambda worked nice and cleanly, but switching to shared_ptr, was almost impossible to work out what was going on, I simply switched to a few composed boost::bind()s and it worked first time, so I have to agree here that Boost.Bind wins out on this simple use, even though it looses the nice syntax of Boost.Lambda.
FWIW, my mileage with Boost.Lambda was much the same - the simple cases worked fine, but anything with smart pointers didn't work well. On other hand, I found that boost::bind worked simply and cleanly, and was a vast improvement over the stl memfun/memfun1/etc family of functions. (I'm also using VC++ 7.1)
Subsequently, the containers now contain std::pair's to shared_ptrs, so I have even more composition going on, which for a one off 'function' is getting messy, with Lambda it should be much simpler so I'd certainly like to know if I missed something with this.
Kevin
-- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |