C++ 未在VS2015上编译绑定对象
在C++ 未在VS2015上编译绑定对象,c++,boost,boost-asio,visual-studio-2015,libtorrent,C++,Boost,Boost Asio,Visual Studio 2015,Libtorrent,在libtorrent中,我找到了以下代码,这些代码不是用Visual Studio 2015 RC编译的: boost::bind( &address::is_v4, boost::bind( &tcp::endpoint::address, _1 ) ) == m_bind_addr.is_v4() 虽然我们可能会对bind中操作符重载的使用存在疑问,但我实际上想知道,为
libtorrent
中,我找到了以下代码,这些代码不是用Visual Studio 2015 RC编译的:
boost::bind( &address::is_v4,
boost::bind( &tcp::endpoint::address,
_1
)
)
== m_bind_addr.is_v4()
虽然我们可能会对bind中操作符重载的使用存在疑问,但我实际上想知道,为什么它不能编译。错误消息是:
C:\Projects\boost\boost/bind/bind.hpp(2003): error C2027: use of undefined type 'boost::_bi::add_cref<Pm,0>'
with
[
Pm=bool (__thiscall boost::asio::ip::address::* )(void) const
]
C:\Projects\boost\boost/bind/bind.hpp(2011): note: see reference to class template instantiation 'boost::_bi::dm_result<M (__thiscall boost::asio::ip::address::* ),A1>' being compiled
with
[
M=bool (void) const,
A1=boost::_bi::bind_t<boost::asio::ip::address,boost::_mfi::cmf0<boost::asio::ip::address,boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>>,boost::_bi::list1<boost::arg<1>>>
]
C:\Projects\boost\boost/bind/bind.hpp(2003):错误C2027:使用未定义的类型“boost::\u bi::add\u cref”
具有
[
Pm=bool(uu thiscall boost::asio::ip::address::*)(void)const
]
C:\Projects\boost\boost/bind/bind.hpp(2011):注意:请参阅正在编译的类模板实例化“boost::\u bi::dm\u result”的参考
具有
[
M=布尔(无效)常数,
A1=boost::\u bi::bind\u t
]
我遇到了这个问题,但只针对32位编译。64位就可以了。围绕mem_fn函数(来自boost/mem_fn.hpp)实现了以下技巧:
boost::bind( &address::is_v4,
boost::bind( boost::mem_fn( &tcp::endpoint::address),
_1
)
) == m_bind_addr.is_v4()