boost::capy::execution_context::use_service

Return a reference to the service of type T, creating it if needed.

Synopsis

template<class T>
T&
use_service();

Description

If no service of type T exists, one is created by calling T(execution_context&). 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&`.

Exception Safety

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

Thread Safety

Thread‐safe.

Return Value

A reference to the service.

Template Parameters

Name Description

T

The type of service to retrieve or create.

Created with MrDocs