C++ Deque shrinktofit function reduces the memory usage to fit the size of the container. This function does not modify the content of a deque.
Syntax
Example
void shrink_to_fit();
Parameter
It does not contain any parameter.
Return value
It does not return any value.
Example 1
Let's see a simple example
Example
#include <iostream>
#include<deque>
using namespace std;
int main()
{
deque<int> d={1,2,3,4,5};
cout<<"size :"<<d.size();
d.resize(3);
cout<<'\n';
cout<<"size:"<<d.size();
d.shrink_to_fit();
return 0;
}