How do I add an element to the position I indicate in std::vector
? Not to delete what you already have, but is to add in the middle. Here's an example:
Let's suppose that within std::vector
has the elements
{1,2,3,4,5,6,7,8,9};
And I want to add a number before 4 and after 3, but without deleting any element, thus:
{1,2,3,10,4,5,6,7,8,9}
How to proceed? Is this possible? Or do I need to use some other container , like list
?