I came across 2 codes depicting the use of .resize() and .shrink_to_fit() and could not understand which one demolishes the elements of the vector.
In example-1 vector has all the elements even after .resize(5) is used while in example-2 .resize(4) eliminates the 5th element of the vector. Have a look and tell if I'm getting something wrong.
Aucun commentaire:
Enregistrer un commentaire