23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.3 Class template deque [deque]

23.3.3.3 deque capacity [deque.capacity]

void resize(size_type sz);

Effects: If sz <= size(), equivalent to erase(begin() + sz, end());. If size() < sz, appends sz - size() value-initialized elements to the sequence.

Requires: T shall be DefaultConstructible.

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

Effects:

if (sz > size())
  insert(end(), sz-size(), c);
else if (sz < size())
  erase(begin()+sz, end());
else
  ;                 // do nothing

Requires: T shall be CopyInsertable into *this.

void shrink_to_fit();

Remarks: shrink_to_fit is a non-binding request to reduce memory use. [ Note: The request is non-binding to allow latitude for implementation-specific optimizations.  — end note ]