I want to be able to insert an element in the middle (or another location) in the vector without overwriting existing element.
Say my vector has 3 6 9 10 and I want to insert 7 right after 6. How should it be done without causing issues? It's very infrequent operation so efficiency is not a problem here. Also, at this point, I cannot switch to another container ( for example: std::list) that are good for insertions in the middle.
Will std::insert
in vector do what I want? How?
thanks