[list.capacity]

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

## 23.3 Sequence containers [[sequences]](sequences#list.capacity)

### 23.3.11 Class template list [[list]](list#capacity)

#### 23.3.11.3 Capacity [list.capacity]

[ð](#lib:resize,list)

`constexpr void resize(size_type sz);
`

[1](#1)

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

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

[2](#2)

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

*Effects*: If size() < sz,
appends sz - size() default-inserted elements to the
sequence[.](#2.sentence-1)

If sz <= size(), equivalent to:list<T>::iterator it = begin();
advance(it, sz);
erase(it, end());

[ð](#lib:resize,list_)

`constexpr void resize(size_type sz, const T& c);
`

[3](#3)

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

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

[4](#4)

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

*Effects*: As if by:if (sz > size()) insert(end(), sz-size(), c);else if (sz < size()) { iterator i = begin();
 advance(i, sz);
 erase(i, end());}else ; // do nothing
