I want to make a callback that also calls back.
I cannot get the code to compile.
I read on the boost documentation about apply()., but the example is
unclear and I am not sure if that is what I am looking for.
/// 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?