std::vector<int> v; v.assign(50,100); v.assign(30,100); 

Is it necessary to clear the memory of v[30], v[31], ..., v[49] ?

  • If you did not select anything, then you do not need to clear anything. - ixSci
  • @ixSci moreover, sometimes it is not necessary to clear even if it is selected. - αλεχολυτ

1 answer 1

Not required - the vector is smart enough to clean it.