template< typename Service> void add_service( execution_context & e, Service * svc);
This function is used to add a service to the execution_context
.
The execution_context
object that
owns the service.
The service object. On success, ownership of the service object is
transferred to the execution_context
. When the
execution_context
object is destroyed, it will destroy the service object by performing:
delete static_cast<execution_context::service*>(svc)
Thrown if a service of the given type is already present in the execution_context
.
Thrown if the service's owning execution_context
is not the
execution_context
object specified by the e
parameter.
Header: asio/impl/execution_context.hpp
Convenience header: asio.hpp