связанные объекты не компилируются в VS2015

В 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>>>
          ]

person abergmeier    schedule 11.05.2015    source источник


Ответы (1)


Я столкнулся с этим, но только для 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()
person kirsch    schedule 27.11.2015