21 Containers library [containers]

21.3 Sequence containers [sequences]

21.3.10 Class template list [list] Capacity [list.capacity]

void resize(size_type sz);
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());
Requires: T shall be Cpp17DefaultInsertable into *this.
void resize(size_type sz, const T& c);
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());
  ;                 // do nothing
Requires: T shall be Cpp17CopyInsertable into *this.