3.2 KiB
[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&);
Effects: Constructs an empty list, using the specified allocator.
Complexity: Constant.
constexpr explicit list(size_type n, const Allocator& = Allocator());
Preconditions: T is Cpp17DefaultInsertable into list.
Effects: Constructs a list withn default-inserted elements using the specified allocator.
Complexity: Linear inn.
constexpr list(size_type n, const T& value, const Allocator& = Allocator());
Preconditions: T is Cpp17CopyInsertable into list.
Effects: Constructs alist withn copies ofvalue, using the specified allocator.
Complexity: Linear inn.
template<class InputIterator> constexpr list(InputIterator first, InputIterator last, const Allocator& = Allocator());
Effects: Constructs alist equal to the range [first, last).
Complexity: Linear indistance(first, last).
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]")<T> R> constexpr list(from_range_t, R&& rg, const Allocator& = Allocator());
Effects: Constructs a list object with the elements of the range rg.
Complexity: Linear in ranges::distance(rg).