Is there a way to make a vector shorter once its length is defined? The book I'm reading says that iterators are needed, or at least that's how I understood it, but I don't quite understand iterators. Can someone give me an easy way to do this, and please explain it? Thanks in advance.
I've been told that if one's vector doesn't contain that many elements, it can still be quite efficient when erasing or inserting elements in the middle. Maybe that is wrong though.
How well it performs depends on a lot of things. Like how efficiently the objects in the vector can be moved, the size of them, where in the vector you're removing from, the size of the vector, and maybe a half dozen other things.
Unless you have a relatively large vector and will be removing elements from the beginning/middle relatively frequently I wouldn't worry about it.