Use std::deque
! Pointers to the elements are stable when only push_back()
is used.
Note: Iterators to elements may be invalidated! Pointers to elements won't.
Edit: this answer explains the details why: C++ deque's iterator invalidated after push_front()