How to remove from the end of the vector?

Hi everyone.

I dont have a lot of experience with STL, so here i am.

I am implementing a certain queue-like behaiviour data structure.

So i have a certain vector, to which i am adding elements via push_back.

Let's say i pushed 1,2,3,4,5 in this order.

So i have 1 2 3 4 5 stored in the vector where 1 is at myVec.begin() position.

Now i want to start removing elements from the front.

Thus after myVec.erase(myVec.begin()) i have the following:

2 3 4 5 5.

As u see, 1 is removed, everything is shifted to the front by 1.

However, i have that left over of 5. And i dont know what to do with that.

Basically what i need is for the vector to shrink as i remove the elements.

So that after myVec.erase(myVec.begin()) i have 2 3 4 5, where 2 is at myVec.begin() position and 5 is at myVec.end() position, and of course with the correct size.

I would appriciate all the help i can get.

Thanks.