An ring priority queue for C++.
- STL-like
- Single-header implementation. Just drop it in your project.
- Not thread-safe
- C++11 implementation
- Fully portable
- Self-sort like std::set
The entire queue's implementation is contained in one header ring_list.h
.
Simple example:
#include "ring_queue.h"
container::RingQueue<int> q;
q.push(2);
q.push(1);
assert(q.front() == 1);
q.pop();
q.clear();
Description of methods:
push(const T& value)
Insert an element into queueemplace(Args&&... args)
Insert an element into queuepop()
Remove the smallest element from headererase(const iterator& position)
Remove element in 'position'front()
The first elementempty()
The queue is empty or notsize()
The element numberclear()
Clear queuebegin()
The begin iteratorend()
The end iterator
I've written quite a few unit tests. The tests depend on googletest, you need install it firstly if you want to run the test. I run the test in windows10/ubuntu18-x64/ubuntu16-armv8, use valgrind check the test as well, There may still be bugs. If anyone is seeing buggy behaviour, I'd like to hear about it! Just open an issue on GitHub.