I want to learn more about deque, and previously I only have basic concept and samples about deque as a double-ended queue.
My questions are,
1. How it is implemented internally for the performance optimization for get front and end elements? Elements are stored in an array or linked list or?
2. Are there any documents about how to use deque effectively and efficiently (i.e. good patterns and anti-patterns of deque)? I have searched MSDN and Google and only found some sample samples. Any experience sharing or recommended articles?
thanks in advance,
This has been answered elsewhere.
There are dozens of ways of implementing a deque. List, vector, vector of vectors etc etc.
Originally Posted by George2
What is your understanding of the statements from The C++ Standard Library book when compare vector with deque? Why one more indirection level?
Originally Posted by iMalc
The internal structure has one more indirection to access the elements, so element access and iterator movement of deques are usually a bit slower.