20 Memory management library [mem]

20.4 Types for composite class design [mem.composite.types]

20.4.1 Class template indirect [indirect]

20.4.1.3 Constructors [indirect.ctor]

The following element applies to all functions in [indirect.ctor]:
Throws: Nothing unless allocator_traits<Allocator>​::​allocate or allocator_traits<Allocator>​::​construct throws.
constexpr explicit indirect();
Constraints: is_default_constructible_v<Allocator> is true.
Mandates: is_default_constructible_v<T> is true.
Effects: Constructs an owned object of type T with an empty argument list, using the allocator alloc.
constexpr explicit indirect(allocator_arg_t, const Allocator& a);
Mandates: is_default_constructible_v<T> is true.
Effects: alloc is direct-non-list-initialized with a.
Constructs an owned object of type T with an empty argument list, using the allocator alloc.
constexpr indirect(const indirect& other);
Mandates: is_copy_constructible_v<T> is true.
Effects: alloc is direct-non-list-initialized with allocator_traits<Allocator>​::​select_on_container_copy_construction(other.alloc).
If other is valueless, *this is valueless.
Otherwise, constructs an owned object of type T with *other, using the allocator alloc.
constexpr indirect(allocator_arg_t, const Allocator& a, const indirect& other);
Mandates: is_copy_constructible_v<T> is true.
Effects: alloc is direct-non-list-initialized with a.
If other is valueless, *this is valueless.
Otherwise, constructs an owned object of type T with *other, using the allocator alloc.
constexpr indirect(indirect&& other) noexcept;
Effects: alloc is direct-non-list-initialized from std​::​move(other.alloc).
If other is valueless, *this is valueless.
Otherwise *this takes ownership of the owned object of other.
Postconditions: other is valueless.
constexpr indirect(allocator_arg_t, const Allocator& a, indirect&& other) noexcept(allocator_traits<Allocator>::is_always_equal::value);
Mandates: If allocator_traits<Allocator>​::​is_always_equal​::​value is false then T is a complete type.
Effects: alloc is direct-non-list-initialized with a.
If other is valueless, *this is valueless.
Otherwise, if alloc == other.alloc is true, constructs an object of type indirect that takes ownership of the owned object of other.
Otherwise, constructs an owned object of type T with *std​::​move(other), using the allocator alloc.
Postconditions: other is valueless.
template<class U = T> constexpr explicit indirect(U&& u);
Constraints:
  • is_same_v<remove_cvref_t<U>, indirect> is false,
  • is_same_v<remove_cvref_t<U>, in_place_t> is false,
  • is_constructible_v<T, U> is true, and
  • is_default_constructible_v<Allocator> is true.
Effects: Constructs an owned object of type T with std​::​forward<U>(u), using the allocator alloc.
template<class U = T> constexpr explicit indirect(allocator_arg_t, const Allocator& a, U&& u);
Constraints:
  • is_same_v<remove_cvref_t<U>, indirect> is false,
  • is_same_v<remove_cvref_t<U>, in_place_t> is false, and
  • is_constructible_v<T, U> is true.
Effects: alloc is direct-non-list-initialized with a.
Constructs an owned object of type T with std​::​forward<U>(u), using the allocator alloc.
template<class... Us> constexpr explicit indirect(in_place_t, Us&&... us);
Constraints:
  • is_constructible_v<T, Us...> is true, and
  • is_default_constructible_v<Allocator> is true.
Effects: Constructs an owned object of type T with std​::​forward<Us>(us)..., using the allocator alloc.
template<class... Us> constexpr explicit indirect(allocator_arg_t, const Allocator& a, in_place_t, Us&& ...us);
Constraints: is_constructible_v<T, Us...> is true.
Effects: alloc is direct-non-list-initialized with a.
Constructs an owned object of type T with std​::​forward<Us>(us)..., using the allocator alloc.
template<class I, class... Us> constexpr explicit indirect(in_place_t, initializer_list<I> ilist, Us&&... us);
Constraints:
  • is_constructible_v<T, initializer_list<I>&, Us...> is true, and
  • is_default_constructible_v<Allocator> is true.
Effects: Constructs an owned object of type T with the arguments ilist, std​::​forward<Us>(us)..., using the allocator alloc.
template<class I, class... Us> constexpr explicit indirect(allocator_arg_t, const Allocator& a, in_place_t, initializer_list<I> ilist, Us&&... us);
Constraints: is_constructible_v<T, initializer_list<I>&, Us...> is true.
Effects: alloc is direct-non-list-initialized with a.
Constructs an owned object of type T with the arguments ilist, std​::​forward<Us>(us)..., using the allocator alloc.