Do I need to check capacity before adding an element to a vector in c++ ?
- by Cassie
Hi dear all,
I am a newbie to c++ STL vectors so sorry for silly questions in advence. :)
In my program, I have a vector which needs to store unknown number of elements.
Do I have to check if the vector has achieved its max_size before adding an new element to it ?
Will a c++ compiler throw an exception automatically when a program tries to add elements to a full vector ?
Thank you very much, Cassie