Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

io_service::add_service

Add a service object to the io_service.

template<
    typename Service>
friend void add_service(
    io_service & ios,
    Service * svc);

This function is used to add a service to the io_service.

Parameters

ios

The io_service object that owns the service.

svc

The service object. On success, ownership of the service object is transferred to the io_service. When the io_service object is destroyed, it will destroy the service object by performing:

delete static_cast<io_service::service*>(svc) 

Exceptions

boost::asio::service_already_exists

Thrown if a service of the given type is already present in the io_service.

boost::asio::invalid_service_owner

Thrown if the service's owning io_service is not the io_service object specified by the ios parameter.


PrevUpHomeNext