deque and vector provide random access, list provides only linear calls. Therefore, if you need to make container [i], this excludes list . On the other hand, you can effectively insert and remove items anywhere in the list , and operations in the middle of vector and deque are slow.
deque and vector very similar and mostly interchangeable for most purposes. There are only two differences that are worth mentioning. Firstly, vector can only effectively add new elements at the end, while deque can effectively add elements at both ends. So why would you ever use vector ? Unlike deque , vector guarantee that all elements will be stored in adjacent memory cells, which speeds up their repetition in some situations.
deong source share