Files
cppdraft_translate/cppdraft/list/cons.md
2025-10-25 03:02:53 +03:00

3.2 KiB
Raw Blame History

[list.cons]

23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.11 Class template list [list]

23.3.11.2 Constructors, copy, and assignment [list.cons]

🔗

constexpr explicit list(const Allocator&);

1

#

Effects: Constructs an empty list, using the specified allocator.

2

#

Complexity: Constant.

🔗

constexpr explicit list(size_type n, const Allocator& = Allocator());

3

#

Preconditions: T is Cpp17DefaultInsertable into list.

4

#

Effects: Constructs a list withn default-inserted elements using the specified allocator.

5

#

Complexity: Linear inn.

🔗

constexpr list(size_type n, const T& value, const Allocator& = Allocator());

6

#

Preconditions: T is Cpp17CopyInsertable into list.

7

#

Effects: Constructs alist withn copies ofvalue, using the specified allocator.

8

#

Complexity: Linear inn.

🔗

template<class InputIterator> constexpr list(InputIterator first, InputIterator last, const Allocator& = Allocator());

9

#

Effects: Constructs alist equal to the range [first, last).

10

#

Complexity: Linear indistance(first, last).

🔗

template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R> constexpr list(from_range_t, R&& rg, const Allocator& = Allocator());

11

#

Effects: Constructs a list object with the elements of the range rg.

12

#

Complexity: Linear in ranges::distance(rg).