Ouroboros is a C++ header only library containing a cyclic deque, otherwise known as a circular buffer, ring buffer, etc. The cyclic deque, named ouroboros::cyclic_deque<>
, describes a sequence container with the first and last element of the sequence seemingly connected end-to-end. A deque (double-ended queue) allows fast insertion and deletion at both its beginning and end.
The library is named after the symbol depicting a serpent or dragon that eats its own tail and it represents the infinite amount of times a circular buffer has been implemented in code throughout history.
Available under the MIT license.
- The capacity of the container can be set at run-time.
- Fast insertion and deletion at both its beginning and end.
- STL compliant. Provides the interface of a random access range.
- Minimal working example for creating and using an
ouroboros::cyclic_deque<>
.
Minimum:
- A compiler that is compliant with the C++17 standard or higher.
- CMake. It is also possible to just copy and paste the ouroboros directory into an include directory.
Optional:
- Doxygen. Needed for generating documentation.
- Google Test. Used for running unit tests.
Build with CMake:
$ mkdir build && cd build
$ cmake ../
$ cmake --build .
$ cmake --build . --target ouroboros_doc
$ cmake --install .
find_package(Ouroboros REQUIRED)
add_executable(myexe main.cpp)
target_link_libraries(myexe PUBLIC Ouroboros::Ouroboros)