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: 23.3.11 [vector], 23.3.3 [array] Status: NAD Editorial Submitter: AFNOR Opened: 1998-10-07 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [vector].

View all issues with NAD Editorial status.

Discussion:

Reserve can not free storage, unlike string::reserve

[ 2010-02-13 Alisdair adds: ]

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

Rationale:

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