deque::shrink_to_fit

Discards excess capacity.

void shrink_to_fit(
);

Remarks

There is no portable way to determine if shrink_to_fit reduces the storage used by a deque Class.

Example

// deque_shrink_to_fit.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( )
{
   using namespace std;   
   deque <int> v1;
   //deque <int>::iterator Iter;

   v1.push_back( 1 );
   v1.push_back( 2 );
   cout << "Current size of v1 = " 
      << v1.size( ) << endl;
   v1.shrink_to_fit();
   cout << "Current size of v1 = " 
      << v1.size( ) << endl;
}
Current size of v1 = 1
Current size of v1 = 1

Requirements

Header: <deque>

Namespace: std

See Also

Reference

deque Class

Standard Template Library