
/// Smart Pointer typedef boost::shared_ptr<TcpServerSideConnection> SmartPtr;
/// Callback function pointer type for TcpListener notification that our execution of /// TcpServerSideConnection::OnConnectionAccepted has completed typedef boost::function
ConnectionAcceptedListenerCallback; /// Callback function pointer type for TcpServerSideConnection notification of /// a TcpListener::Listen IO completion typedef boost::function
ConnectionAcceptedCallback; TcpListener::SmartPtr me = boost::dynamic_pointer_cast
(shared_from_this()); TcpServerSideConnection::ConnectionAcceptedListenerCallback listenerCallback = boost::bind(&TcpListener::OnConnectionAccepted, me, _1, _2);
TcpServerSideConnection::ConnectionAcceptedCallback acceptCompleteCallback = boost::bind(&TcpServerSideConnection::OnConnectionAccepted, newConnection, listenerCallback, boost::asio::placeholders::error);
acceptor_.async_accept(newConnection->GetSocket(), acceptCompleteCallback);
Gives me a compile error in bind.hpp with 100s of pages.
What am I doing wrong here? Does anyone have an example of a callback that callsback using boost::bind?
In general, I think you should use boost::protect around "listenerCallback", but if you need help with exact expression, please provide a self-contained sample.