English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C++ Basic Tutorial

C++ Flow Control (Flow Control)

C++ Function (Function)

C++ Array & String (Array & String)

C++ Data Structure (Data Structure)

C++ Class & Object (Class & Object)

C++ Pointer (Pointer)

C++ Inheritance (Inheritance)

C++ STL Tutorial (STL Tutorial)

C++ Reference Manual

C++ vector shrink_to_fit() Usage and Example

C++ Vector (Container)

This function is used to change the capacity of the vector (vector) to be equal to the size of the vector (vector). That is, set the capacity to the length of the container.

Syntax

The syntax of the vector (vector) 'v' is as follows:

v.shrink_to_fit();

Parameters

It does not contain any parameters.

Return Value

It does not return any value.

C++ Vector (Container)