Niall Douglas wrote:
In AFIO I was not surprised by shared_ptr, but I was quite surprised by my use of boost::bind => std::bind which did not convert over identically. The fix was trivial, but I still learned I had been sloppy.
There are enough subtle (and pretty much intentional) differences between
boost::bind and std::bind that the two aren't interchangeable. In the past,
when C++11 was the future, I've sometimes said that in a C++11 Boost
boost/bind.hpp will just contain namespace boost { using std::bind; }, but
it can't. This will break a ton of code.
For instance, given these two functions:
void f( int x )
{
std::cout << "f(" << x << ")\n";
}
void f( int x, int y )
{
std::cout << "f(" << x << ", " << y << ")\n";
}
then
boost::bind( f, 1 )();
works, and
std::bind( f, 1 )();
doesn't. Conversely, for most std::bind implementations, this
std::bind