This is generally an inefficient operation basause it causes the container to relocate all the elements. It's better to use std::deque in your case.