Boost :: function error ambiguous overload for 'operator []

The full error I get is this:

error: ambiguous overload for β€˜operator[]’ in β€˜a[boost::_bi::storage4<A1, A2, A3,     
boost::arg<I> >::a4_ [with A1 = boost::_bi::value<MsgProxy*>, A2 = boost::arg<1>, A3 = 
boost::arg<2>, int I = 3]]’

It refers to line 116 of class I, which is a call to boost :: bind in this function:

// Dispatch a message onto all connected clients
void MsgProxy::dispatch_msg(t_ic_msg_shptr message) {
    deque<t_socket_shptr>::const_iterator iter = clientList_.begin();

    for(; iter != clientList_.end(); ++iter) {
        message->async_send(*iter,
                boost::bind(&MsgProxy::handle_dispatch, this, _1, _2, _3));
    }
}

For reference, the descriptor send function is as follows:

// Called to handle result of saync_send command in dispatch_msg
void MsgProxy::handle_dispatch(t_ic_msg_shptr messsage, t_socket_shptr socket_ptr, 
                   const boost::system::error_code &error) {
    if (error) {
    RDEBUG("Error forwarding message onto clients -- %s",
           error.message().c_str());
    }
}

And finally, the async_send function, which is called:

void async_send        (t_socket_shptr, t_icsend_callback);

Where t_icsend_callback:

typedef boost::function<void (t_socket_shptr, const boost::system::error_code&)> 
                                                              t_icsend_callback;

(async_send), , ( boost::), . boost:: function, boost , . boost:: function boost: , , ... , , ... .

+3
1

t_icsend_callback - , .

boost::bind(&MsgProxy::handle_dispatch, this, _1, _2, _3)

, 3 .

,

   message->async_send(*iter,
            boost::bind(&MsgProxy::handle_dispatch, this, message, _1, _2));

( "" ).

+2

Source: https://habr.com/ru/post/1734495/


All Articles