c++ - 将 std::bind 与 boost::signals2 一起使用是否安全?

标签 c++ boost bind signals member-functions

使用 std::bind 将成员函数传递给 boost::signals2::signal::connect() 是否安全?换句话说,boost::bind 和 std::bind 可以互换吗?

它使用 VC++ 2010 SP1 编译,但模板代码让我难以理解,恐怕我可能会冒险进入未定义的行为领域。

最佳答案

我在这方面没有经验,因为我希望 connect 接受任何实现有效函数调用运算符的东西。使用与签名匹配的任何函数或函数对象调用它应该是安全的,无论是 boost::bind、std::bind 还是其他任何东西。 Boost 库被设计为通用的,因此它们通常不会互相挑选实现细节。

关于c++ - 将 std::bind 与 boost::signals2 一起使用是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7709550/

相关文章:

c++ - GetFIleVersionInfoSize() 成功但返回不正确的大小

c++ - 在 autotools 项目中添加 C++ 支持?

c++ - 使用 boost assign 初始化具有固定大小的 vector 的 vector

linux - "searchd"显示 "FATAL: bind() failed on 0.0.0.0: Address already in use"

c - 绑定(bind)到 C 中的特定 IP for ubuntu

jquery - 无法取消绑定(bind)到 $(document) 的事件

C++:在 MFC 应用程序中使用 WM_ERASEBKGND 消息避免闪烁

c++ - 为什么有不同类型的指针?

c++ - 将 Boost 序列化与 xml_oarchive 一起使用时 assertion_failed

c++ - boost::mutex 在模板中使用时不起作用