http://www.cplusplus.com/reference/stl/deque/Deque sequences have the following properties:
- Individual elements can be accessed by their position index.
- Iteration over the elements can be performed in any order.
- Elements can be efficiently added and removed from any of its ends (either the beginning or the end of the sequence)
On the drawback side, unlike
vectors,
deques
are not guaranteed to have all its elements in contiguous连续的 storage
locations, eliminating排除 thus the possibility of safe access through
pointer arithmetics.
For operations that involve frequent insertion or removals of elements at positions other than the beginning or the end, deques perform worse and have less consistent iterators and references than lists.