Re: [Boost-users] Bind and overloaded operators in Visual Studio 2008

The bug you're seeing is in Dinkumware's bind, not boost's. Try using boost::bind explicitly and I suspect it will work fine.
Thanks for the quick answer. I replaced it with #include <boost/bind.hpp> std::find_if(v.begin(), v.end(), boost::bind( &Foo::first_, _1 ) == test ); which works. I did, however, configure Visual Studio to prefer Boost's TR1 implementation by adding the following include directories before the Microsoft includes (Tools->Options->Projects and Solutions->VC++ Directories->Include files): - boost-root/boost/tr1/tr1 - boost-root This worked as expected with VS2005 but with VS2008 the Microsoft/Dinkumware includes are apparently still preferred. Greets, Ben

Hello, Benjamin. Thursday, November 13, 2008 at 1:19:30 PM you wrote:
The bug you're seeing is in Dinkumware's bind, not boost's. Try using boost::bind explicitly and I suspect it will work fine.
BS> Thanks for the quick answer. I replaced it with BS> #include <boost/bind.hpp> BS> std::find_if(v.begin(), v.end(), boost::bind( &Foo::first_, _1 ) == test BS> ); I think what the better way is to use boost::lambda::bind instead of boost::bind for such purposes. If you'll use boost::lambda you will have guarantee what you code remains unambiguous. Try: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> namespace bl = boost::lambda; std::find_if(v.begin(), v.end(), bl::bind( &Foo::first_, bl::_1 ) == test); -- Best Regards, Sergey mailto:flex_ferrum@artberg.ru
participants (2)
-
Benjamin Swerts
-
Sergey Sadovnikov