I cannot speak for anyone else, but I can for myself.
When I first read about std::deque , I thought it was cool enough that for a while I saw it not only as the default container, but as almost the only container I used.
Then someone asked why, and I described in detail its advantages and why it was the best container to use for almost everything and how it was much more universal than std::vector .
Fortunately, the guy who was interrogating my decision on this was convincing enough that I did some testing. Testing showed that almost every case of std::deque was slower than std::vector - often with a significant factor (for example, around 2). In fact, the code I wrote using std::deque , just replacing std::deque with std::vector gave acceleration in all cases, except for a few cases.
I have used std::deque on several occasions since then, but I definitely don't see it as the default. The simple fact is that in a regular implementation this is noticeably slower than std::vector for most purposes.
I must add, however, that I am sure that, if implemented correctly, it is almost equivalent to std::vector almost all cases. Most of them use a representation that, undoubtedly, is of great importance from the point of view of asymptotics, but does not work so well (for many purposes) in the real world.
Jerry Coffin Dec 07 '12 at 7:21 2012-12-07 07:21
source share