This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.

101. No way to free storage for vector and deque

Section: 26.3.11 [vector], 26.3.7 [array] Status: NAD Editorial Submitter: AFNOR Opened: 1998-10-07 Last modified: 2017-02-03

Priority: Not Prioritized

View all other issues in [vector].

View all issues with NAD Editorial status.


Reserve can not free storage, unlike string::reserve

[ 2010-02-13 Alisdair adds: ]

This issue has been revisited and addressed (755, 850). This issues should be reclassified to NAD Editorial to reflect this action.


This is not a defect in the Standard. The LWG has considered this issue in the past and sees no need to change the Standard. Deque has no reserve() member function. For vector, shrink-to-fit can be expressed in a single line of code (where v is vector<T>):

vector<T>(v).swap(v);  // shrink-to-fit v