[list.cons] # 23 Containers library [[containers]](./#containers) ## 23.3 Sequence containers [[sequences]](sequences#list.cons) ### 23.3.11 Class template list [[list]](list#cons) #### 23.3.11.2 Constructors, copy, and assignment [list.cons] [🔗](#lib:list,constructor) `constexpr explicit list(const Allocator&); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9211) *Effects*: Constructs an empty list, using the specified allocator[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9215) *Complexity*: Constant[.](#2.sentence-1) [🔗](#lib:list,constructor_) `constexpr explicit list(size_type n, const Allocator& = Allocator()); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9226) *Preconditions*: T is *Cpp17DefaultInsertable* into list[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9230) *Effects*: Constructs a list withn default-inserted elements using the specified allocator[.](#4.sentence-1) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9235) *Complexity*: Linear inn[.](#5.sentence-1) [🔗](#lib:list,constructor__) `constexpr list(size_type n, const T& value, const Allocator& = Allocator()); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9247) *Preconditions*: T is *Cpp17CopyInsertable* into list[.](#6.sentence-1) [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9251) *Effects*: Constructs alist withn copies ofvalue, using the specified allocator[.](#7.sentence-1) [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9261) *Complexity*: Linear inn[.](#8.sentence-1) [🔗](#lib:list,constructor___) `template constexpr list(InputIterator first, InputIterator last, const Allocator& = Allocator()); ` [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9274) *Effects*: Constructs alist equal to the range [first, last)[.](#9.sentence-1) [10](#10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9281) *Complexity*: Linear indistance(first, last)[.](#10.sentence-1) [🔗](#lib:list,constructor____) `template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]") R> constexpr list(from_range_t, R&& rg, const Allocator& = Allocator()); ` [11](#11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9294) *Effects*: Constructs a list object with the elements of the range rg[.](#11.sentence-1) [12](#12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L9298) *Complexity*: Linear in ranges​::​distance(rg)[.](#12.sentence-1)