What's the difference between deque and list STL containers?

前端 未结 8 1575
滥情空心
滥情空心 2020-12-07 10:08

What is the difference between the two? I mean the methods are all the same. So, for a user, they work identically.

Is that correct??

8条回答
  •  失恋的感觉
    2020-12-07 10:42

    std::list is basically a doubly linked list.

    std::deque, on the other hand, is implemented more like std::vector. It has constant access time by index, as well as insertion and removal at the beginning and end, which provides dramatically different performance characteristics than a list.

提交回复
热议问题