mardi 25 février 2020

Difference between std::resize(n) and std::shrink_to_fit in C++?

I came across these statements:

resize(n) – Resizes the container so that it contains ‘n’ elements. shrink_to_fit() – Reduces the capacity of the container to fit its size and destroys all elements beyond the capacity.

Is there any significant difference between these functions? they come under vectors in c++

Aucun commentaire:

Enregistrer un commentaire