Shmoopty / veque

Fast C++ container combining the best features of std::vector and std::deque
Boost Software License 1.0
119 stars 6 forks source link

veque

The double-ended vector


A very fast C++17 container combining the best features of std::vector and std::deque

"In Most Cases, Prefer Using deque (Controversial)"

-Herb Sutter, GotW #54

veque is an allocator-aware, efficient container with interface matching both std::vector and std::deque. Its data layout is very similar to std::vector, but with unused storage maintained both before and after the used storage.

Features

Usage

The complete API documentation may be viewed here.

The interface for veque maintains the entire interface for std::vector, allowing veque to be considered as a drop-in replacement. (See tradeoffs)

In addition, veque provides the following additional functions:

std::deque interface:

End-specific resizing:

Strong exception guarantee pop-and-return, courtesy C++17:

In the spirit of C++20, it is reasonable to ask for the size as a signed type:

Tradeoffs

Is veque better than std::vector in every conceivable way? No. But the tradeoffs are appealing.

Why "veque"?

As a developer, I am not good at naming things.

double_ended_vector?

dextor?

To do: