...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Create a new handler that automatically dispatches the wrapped handler on the strand.
template< typename Handler> unspecified wrap( Handler handler);
This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the strand's dispatch function.
The handler to be wrapped. The strand will make a copy of the handler object as required. The function signature of the handler must be:
void handler(A1 a1, ... An an);
A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature:
R f(A1 a1, ... An an);
If this function object is passed to the wrap function like so:
strand.wrap(f);
then the return value is a function object with the signature
void g(A1 a1, ... An an);
that, when invoked, executes code equivalent to:
strand.dispatch(boost::bind(f, a1, ... an));