asio C++ library

PrevUpHomeNext
execution_context::use_service (2 of 2 overloads)

Obtain the service object corresponding to the given type.

template<
    typename Service>
Service & use_service(
    io_context & ioc);

This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the io_context will create a new instance of the service.

Parameters

ioc

The io_context object that owns the service.

Return Value

The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.

Remarks

This overload is preserved for backwards compatibility with services that inherit from io_context::service.

Requirements

Header: asio/execution_context.hpp

Convenience header: asio/execution.hpp


PrevUpHomeNext