[forward.list.cons]

# 23 Containers library [[containers]](./#containers)

## 23.3 Sequence containers [[sequences]](sequences#forward.list.cons)

### 23.3.7 Class template forward_list [[forward.list]](forward.list#cons)

#### 23.3.7.2 Constructors, copy, and assignment [forward.list.cons]

[ð](#lib:forward_list,constructor)

`constexpr explicit forward_list(const Allocator&);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7146)

*Effects*: Constructs an empty forward_list object using the specified allocator[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7150)

*Complexity*: Constant[.](#2.sentence-1)

[ð](#lib:forward_list,constructor_)

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

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7161)

*Preconditions*: T is *Cpp17DefaultInsertable* into forward_list[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7165)

*Effects*: Constructs a forward_list object with n default-inserted elements using the specified allocator[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7170)

*Complexity*: Linear in n[.](#5.sentence-1)

[ð](#lib:forward_list,constructor__)

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

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7181)

*Preconditions*: T is *Cpp17CopyInsertable* into forward_list[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7185)

*Effects*: Constructs a forward_list object with n copies of value using the specified allocator[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7189)

*Complexity*: Linear in n[.](#8.sentence-1)

[ð](#lib:forward_list,constructor___)

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

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7201)

*Effects*: Constructs a forward_list object equal to the range [first, last)[.](#9.sentence-1)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7205)

*Complexity*: Linear in distance(first, last)[.](#10.sentence-1)

[ð](#lib:forward_list,constructor____)

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

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7217)

*Effects*: Constructs a forward_list object
with the elements of the range rg[.](#11.sentence-1)

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L7222)

*Complexity*: Linear in ranges​::​distance(rg)[.](#12.sentence-1)
