Click here to Skip to main content
15,849,907 members
Articles / Programming Languages / C++17

It is Better to Use Devector Than std::deque

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
10 Sep 2022CPOL7 min read 7.5K   67   9  
This article shows that double-ended vector is much faster than std::deque and should be preferred.
This article discusses double-ended vector, which allows to "push front" as well as "push back", in contrast to std::vector, where only the "push back" is available. It looks at Boost devector. It shows an area where the implementation can be improved (insertion inside the vector), provides an alternative implementation, called DeVector. In this article, the performance of both implementations is compared with std::deque, which demonstrates that double-ended vector is usually faster than std::deque. The source code is provided that can be compiled in any C++17 compiler.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions