VS2010有boost :: bind问题吗?

ere*_*eOn 5 c++ boost bind visual-studio-2010

我有以下代码行,它在2010年之前的g ++和Visual Studio下编译得很好.

std::vector<Device> device_list;

boost::function<void (Device&, boost::posix_time::time_duration&)> callback = 
  boost::bind(&std::vector<Device>::push_back, &device_list, _1);
Run Code Online (Sandbox Code Playgroud)

Device班级在哪里,没什么特别的.

现在我刚刚将我的Visual Studio版本升级到2010并且编译失败了:

Error   1   error C2780: 'boost::_bi::bind_t<_bi::dm_result<MT::* ,A1>::type,boost::_mfi::dm<M,T>,_bi::list_av_1<A1>::type> boost::bind(M T::* ,A1)' : expects 2 arguments - 3 provided C:\developments\libsystools\trunk\src\upnp_control_point.cpp    95
Run Code Online (Sandbox Code Playgroud)

发生了什么,我该如何解决这个问题?

谢谢.

Ste*_*end 10

这可能是因为vector::push_back现在通过支持或C++ 0x功能有2个重载,使得bind模糊不清.

void push_back(
   const Type&_Val
);
void push_back(
   Type&&_Val
);
Run Code Online (Sandbox Code Playgroud)

这应该工作,或使用@ DeadMG答案中建议的内置函数:

std::vector<Device> device_list;

boost::function<void (Device&, boost::posix_time::time_duration&)> callback = 
  boost::bind(static_cast<void (std::vector<Device>::*)( const Device& )>
  (&std::vector<Device>::push_back), &device_list, _1);
Run Code Online (Sandbox Code Playgroud)