13 Asynchronous model [async]

13.5 Class template associated_allocator [async.assoc.alloc]

Class template associated_allocator is an associator ([async.reqmts.associator]) for the ProtoAllocator ([async.reqmts.proto.allocator]) type requirements, with default candidate type allocator<void> and default candidate object allocator<void>().

namespace std {
namespace experimental {
namespace net {
inline namespace v1 {

  template<class T, class ProtoAllocator = allocator<void>>
  struct associated_allocator
  {
    using type = see below;

    static type get(const T& t, const ProtoAllocator& a = ProtoAllocator()) noexcept;
  };

} // inline namespace v1
} // namespace net
} // namespace experimental
} // namespace std

Specializations of associated_allocator shall satisfy the requirements in Table [tab:async.assoc.alloc.requirements]. In this table, X is a specialization of associated_allocator for the template parameters T and ProtoAllocator; t is a (possibly const) value of type T; and a is an object of type ProtoAllocator.

Table 8associated_allocator specialization requirements
ExpressionReturn typeNote
typename X::type A type meeting the proto-allocator ([async.reqmts.proto.allocator]) requirements.
X::get(t) X::type Shall not exit via an exception. Equivalent to X::get(t, ProtoAllocator()).
X::get(t, a) X::type Shall not exit via an exception.

13.5.1 associated_allocator members [async.assoc.alloc.members]

using type = see below;

Type: T::allocator_type if the qualified-id T::allocator_type is valid and denotes a type (C++ 2014 [temp.deduct]). Otherwise ProtoAllocator.

type get(const T& t, const ProtoAllocator& a = ProtoAllocator()) noexcept;

Returns: t.get_allocator() if the qualified-id T::allocator_type is valid and denotes a type (C++ 2014 [temp.deduct]). Otherwise a.