Facebook Page Twitter Page LinkedIn Page
× C++ Standard Library C++ STL Library


The C++ vector::~vector function is used to destroy the vector. The destructors of the elements are called and the used storage is deallocated.

C++98: The vector is destroyed and the storage capacity of vector is deallocated using its allocator.

C++11: The allocator_traits::destroy is called on each element of the vector and the storage capacity of vector is deallocated using its allocator.

Note:: If the elements of the vector are pointers, the pointed-to objects are not destroyed.

Syntax

~vector();

Parameters

No parameter is required.

Return Value

None.

Time Complexity

Linear i.e, Θ(n).

Exceptions

Never throws exceptions.


❮ C++ <vector> Library