24 Containers library [containers]

24.3 Sequence containers [sequences]

24.3.10 Class template list [list]

24.3.10.3 Capacity [list.capacity]

void resize(size_type sz);
Preconditions: T is Cpp17DefaultInsertable into *this.
Effects: If size() < sz, appends sz - size() default-inserted elements to the sequence.
If sz <= size(), equivalent to: list<T>::iterator it = begin(); advance(it, sz); erase(it, end());
void resize(size_type sz, const T& c);
Preconditions: T is Cpp17CopyInsertable into *this.
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