以下代码片段在 Visual Studio 2005(带有 boost 1.34)中有效,但无法在 Visual Studio 2015(带有 boost 1.62)中编译,提示“错误 C2672:‘boost::bind’:未找到匹配的重载函数”
我是不是漏掉了什么?
谢谢!
typedef boost::shared_ptr< int > SProxySharedPtr;
SProxySharedPtr m_sptr_proxy;
auto a = boost::bind(&SProxySharedPtr::reset, &m_sptr_proxy);
最佳答案
boost::shared_ptr<.>::reset()
是一个重载的成员函数。因此,您必须明确指定要使用的重载:
auto a = boost::bind(static_cast<void(SProxySharedPtr::*)()>(&SProxySharedPtr::reset), &m_sptr_proxy);
关于c++ - 绑定(bind) shared_ptr::reset - 未找到匹配的重载函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41404347/