Steven Watanabe | 4 Jul 01:57
Picon

Re: [Boost.Bind] Adding a single argument to an existing function, breaks the code.

AMDG

Vjekoslav Brajkovic wrote:
> On Thu, 3 Jul 2008, Steven Watanabe wrote:
>
>> Does it work if you use mem_fn?
>>
>> boost::bind(
>> boost::mem_fn(&com_client::handle_connect),
>> this,
>> 2,
>> boost::asio::placeholders::error,
>> ++endpoint_iterator)
>>
>> How about an explicit return type?
>>
>> boost::bind<void>(
>> &com_client::handle_connect,
>> this,
>> 2,
>> boost::asio::placeholders::error,
>> ++endpoint_iterator)
>>
>>
>
> Nope. Same errors. I've tried both suggestions and their combinations
> with no success.

Exactly the same errors? Including the third line of the error message?
I've marked that parts I would expect to be different.

/usr/local/include/boost-1_35/boost/bind/bind_template.hpp:15: 
instantiated from ‘boost::_bi::bind_t<
**boost::_bi::unspecified** // void??
, void (com_client::*)(command_t, const boost::system::error_code&, 
boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>),
//Something involving _mfi::?? ^^^^^^^^^^^

boost::_bi::list3<boost::_bi::value<com_client*>, boost::arg<1> (*)(),
boost::_bi::value<boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp> 
 > > >’

What is the type of boost::mem_fn(&com_client::handle_connect)?
I usually get this information using

#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>

BOOST_MPL_ASSERT((boost::is_same<__typeof__(boost::mem_fn(&com_client::handle_connect)), 
void>));

In Christ,
Steven Watanabe

Gmane