Files
2025-10-25 03:02:53 +03:00

9.4 KiB
Raw Permalink Blame History

[indirect.ctor]

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]

1

#

The following element applies to all functions in [indirect.ctor]:

2

#

Throws: Nothing unless allocator_traits::allocate orallocator_traits::construct throws.

🔗

constexpr explicit indirect();

3

#

Constraints: is_default_constructible_v is true.

4

#

Mandates: is_default_constructible_v is true.

5

#

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);

6

#

Mandates: is_default_constructible_v is true.

7

#

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);

8

#

Mandates: is_copy_constructible_v is true.

9

#

Effects: alloc is direct-non-list-initialized withallocator_traits::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);

10

#

Mandates: is_copy_constructible_v is true.

11

#

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;

12

#

Effects: alloc is direct-non-list-initialized fromstd::move(other.alloc).

If other is valueless, *this is valueless.

Otherwise *this takes ownership of the owned object of other.

13

#

Postconditions: other is valueless.

🔗

constexpr indirect(allocator_arg_t, const Allocator& a, indirect&& other) noexcept(allocator_traits<Allocator>::is_always_equal::value);

14

#

Mandates: If allocator_traits::is_always_equal::value is false then T is a complete type.

15

#

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.

16

#

Postconditions: other is valueless.

🔗

template<class U = T> constexpr explicit indirect(U&& u);

17

#

Constraints:

is_same_v<remove_cvref_t, indirect> is false,

is_same_v<remove_cvref_t, in_place_t> is false,

is_constructible_v<T, U> is true, and

is_default_constructible_v is true.

18

#

Effects: Constructs an owned object of type T with std::forward(u), using the allocator alloc.

🔗

template<class U = T> constexpr explicit indirect(allocator_arg_t, const Allocator& a, U&& u);

19

#

Constraints:

is_same_v<remove_cvref_t, indirect> is false,

is_same_v<remove_cvref_t, in_place_t> is false, and

is_constructible_v<T, U> is true.

20

#

Effects: alloc is direct-non-list-initialized with a.

Constructs an owned object of type T withstd::forward(u), using the allocator alloc.

🔗

template<class... Us> constexpr explicit indirect(in_place_t, Us&&... us);

21

#

Constraints:

is_constructible_v<T, Us...> is true, and

is_default_constructible_v is true.

22

#

Effects: Constructs an owned object of type T withstd::forward(us)..., using the allocator alloc.

🔗

template<class... Us> constexpr explicit indirect(allocator_arg_t, const Allocator& a, in_place_t, Us&& ...us);

23

#

Constraints: is_constructible_v<T, Us...> is true.

24

#

Effects: alloc is direct-non-list-initialized with a.

Constructs an owned object of type T withstd::forward(us)..., using the allocator alloc.

🔗

template<class I, class... Us> constexpr explicit indirect(in_place_t, initializer_list<I> ilist, Us&&... us);

25

#

Constraints:

is_constructible_v<T, initializer_list&, Us...> is true, and

is_default_constructible_v is true.

26

#

Effects: Constructs an owned object of type T with the argumentsilist, std::forward(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);

27

#

Constraints: is_constructible_v<T, initializer_list&, Us...> is true.

28

#

Effects: alloc is direct-non-list-initialized with a.

Constructs an owned object of type T with the argumentsilist, std::forward(us)..., using the allocator alloc.