C ++的std ::绑定和boost之间11 ::绑定的区别 [英] Difference between C++11 std::bind and boost::bind
问题描述
时两者之间有什么区别吗?还是我的安全,以取代我的code 的boost ::绑定
按的std ::绑定
的每次出现从而在加速删除的依赖?
Is there any difference between the two? Or am I safe to replace every occurrence of boost::bind
by std::bind
in my code and thereby remove the dependence on Boost?
推荐答案
-
的boost ::绑定
已重载关系运算符,的std ::绑定
没有。
的boost ::绑定
支持非默认调用约定,的std ::绑定
不保证(标准库的实现可以提供这为扩展名)。
boost::bind
supports non-default calling conventions, std::bind
is not guaranteed to (standard library implementations may offer this as an extension).
的boost ::绑定
提供了一个直接的机制,允许一到的 prevent 的嵌套绑定前$ P急于评价$ pssions(<一个href=\"http://www.boost.org/libs/bind/#bind.purpose.using_nested_binds_for_function_\"><$c$c>boost::protect$c$c>), 的std ::绑定
没有。(这就是说,人们可以使用的boost ::保障
与的std ::绑定
如果他们愿意,或平凡重新实现它自己。)
boost::bind
provides a direct mechanism to allow one to prevent eager evaluation of nested bind expressions (boost::protect
), std::bind
does not. (That said, one can use boost::protect
with std::bind
if they want, or trivially reimplement it on their own.)
的std ::绑定
提供了一个直接的机制,允许一个治疗任何用户定义的函数对象为嵌套绑定前pression以力的渴望评价(<一个href=\"http://en.cp$p$pference.com/w/cpp/utility/functional/is_bind_ex$p$pssion\"><$c$c>std::is_bind_ex$p$pssion$c$c>: §20.8.9.1.1/ 1,§20.8.9.1.2/ 10),的boost ::绑定
没有。
std::bind
provides a direct mechanism to allow one to treat any user defined functor as a nested bind expression in order to force eager evaluation (std::is_bind_expression
: §20.8.9.1.1/1, §20.8.9.1.2/10), boost::bind
does not.
这篇关于C ++的std ::绑定和boost之间11 ::绑定的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!