C ++的std ::绑定和boost之间11 ::绑定的区别 [英] Difference between C++11 std::bind and boost::bind

查看:117
本文介绍了C ++的std ::绑定和boost之间11 ::绑定的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时两者之间有什么区别吗?还是我的安全,以取代我的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::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), 的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: §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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆