An asynchronous agent has associated characteristics that specify how asynchronous operations should behave when composed as part of that agent, such as:
When an asynchronous operation is run within an asynchronous agent, its implementation may query these associated characteristics and use them to satisfy the requirements or preferences they represent. The asynchronous operation performs these queries by applying associator traits to the completion handler. Each characteristic has a corresponding associator trait.
An associator trait may be specialised for concrete completion handler types to:
Given an associator trait named[2] associated_R
,
having:
s
of
type S
, in this case
the completion handler and its type,
R
that define the syntactic and semantic requirements of the associated
characteristic, and
c
of type C
that meets
the type requirements R
,
which represents a default implementation of the associated characteristic,
supplied by the asynchronous operation
the asynchronous operation uses the associator trait to compute:
associated_R<S, C>::type
,
and
associated_R<S, C>::get(s, c)
that meet the requirements defined in R
.
For convenience, these are also accessible via type alias associated_R_t<S, C>
and free function get_associated_R(s,
c)
,
respectively.
The trait's primary template is specified such that:
S::R_type
is well-formed, defines a
nested type alias type as S::R_type
,
and a static member function get that returns s.get_R()
associator<associated_R, S, C>::type
is well-formed and denotes a type, inherits from associator<associated_R, S, C>
C
,
and a static member function get that returns c
.
[2]
The associator traits are named associated_allocator
, associated_executor
,
and associated_cancellation_slot
.