boost::capy::execution_context::make_service

Construct and add a service.

Synopsis

template<
    class T,
    class... Args>
T&
make_service(Args&&... args);

Description

A new service of type T is constructed using the provided arguments and added to the container. If T has a nested key_type, the service is also indexed under that type.

Constraints

  • `T` must derive from `service`.

  • `T` must be constructible from `execution_context&, Args...`.

  • If `T::key_type` exists, `T&` must be convertible to `key_type&`.

Exception Safety

Strong guarantee. If service creation throws, the container is unchanged.

Thread Safety

Thread‐safe.

Exceptions

Name

Thrown on

std::invalid_argument

if a service of the same type or key_type already exists.

Return Value

A reference to the created service.

Template Parameters

Name Description

T

The type of service to create.

Parameters

Name Description

args

Arguments forwarded to the constructor of T.

Created with MrDocs