The deque class in C++

Going through some really valuable and practical C++ issues from this resource from Stanford, I came across the deque STL class in C++. Seems pretty interesting to me. Although there are performance issues to take into consideration, seeing as, unlike the vector class which ensures that all elements come from contiguous blocks of memory, the deque implementation is a little different in that the elements might be spread out across different pages in the memory. However, it does allow for pushing and popping from both ends of the queue (hence the name dequedouble ended queue), and in certain situations when the queue is going to be small and you are frequently going to be pushing and popping at both ends, deque is a really invaluable resource to have in your toolkit. This location very nicely and thoroughly differentiates deques from vectors. One of the exercises in the course reader was a ring buffer, which I implemented and posted here – really straightforward and simple to implement.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s