这两者之间有什么区别吗?或者,在代码中将每次出现的boost::bind
都替换为std::bind
,从而消除对Boost的依赖,这样做安全吗?
发布于 2012-05-13 17:54:32
除了上面列出的,boost::bind还有一个重要的扩展点: get_pointer()函数,它允许将boost::bind与任何智能指针集成,例如。ATL::CComPtr等http://www.boost.org/doc/libs/1_49_0/libs/bind/mem_fn.html#get_pointer
因此,使用boost::bind还可以绑定一个weak_ptr:http://lists.boost.org/Archives/boost/2012/01/189529.php
发布于 2012-05-12 00:58:38
我没有完整的答案,但std::bind
将使用可变模板而不是参数列表。
与在std::placeholders::_1
中一样,占位符在std::placeholders
中,而不是全局名称空间。
我为stdph的命名空间设置了别名。
namespace stdph=std::placeholders;
除此之外,我更新到C++11没有任何问题。
https://stackoverflow.com/questions/10555566
复制相似问题