#include #define TR1 #if defined(TR1) #include // MSVS 2008: std::tr1::function<> and std::tr1::bind<>, among others #else #include #endif #include using boost::system::error_code; #if defined(TR1) using std::tr1::function; #else using boost::function; #endif using boost::bind; // <== notice this // declare global from elsewhere void AddErrorSink(function fn); class D { public: typedef function Action; void AddErrorAction(Action &a); protected: void exec_actor(Action &a, error_code ec); }; void D::AddErrorAction(Action &a) { // when TR1 is defined for compilation, this line fails: // >> error C2668: 'boost::bind' : ambiguous call to overloaded function // ambiguity shown between boost::bind and std::tr1::bind // can be overcome by qualifying call ("boost::bind") AddErrorSink(bind(&D::exec_actor, this, a, _1)); }