A fast implementation of a (templatized) circular queue container (with std::vector
as underlying buffer) and automatic resizing as required. Complete with (most) functions of std::queue
, including move/cpy constructors.
C++11 or later
To compile with g++
g++ fast-queue.cpp -o fast-queue -std=c++0x
FastQueue::enqueue(const T&)
: (Circularly) Enqueue an element
FastQueue::dequeue()
: Dequeue an element
FastQueue::front()
: Return reference to the front element of the queue
FastQueue::back()
: Return reference to the back element of the queue
FastQueue::at(size_t)
: Return reference to the element on specified (circular) index
FastQueue::size()
: Return size of the queue
FastQueue::capacity()
: Return capacity of the queue
FastQueue::dequeue()
: Dequeue an element
FastQueue::fastQueueIsFull()
: Check if the queue is full
FastQueue::fastQueueIsEmpty()
: Check if the queue is empty
FastQueue::shrink_to_fit()
: Shrink the capacity of the queue to the current size +2 (implementation detail)
- CLion - A cross-platform IDE for C and C++
- Siraj Qazi
This project is licensed under the GNU General Public License - see the LICENSE.md file for details