|
RADLib
RADical C++ application framework
|
Power-of-two circular buffer with push/pop at both ends. More...
#include <RADDataStructures.h>
Classes | |
| class | const_iterator |
| Const forward iterator over logical ring order. More... | |
| class | iterator |
| Forward iterator over logical ring order. More... | |
Public Member Functions | |
| RADRingBuffer (size_t capacity=16) | |
| Creates a ring buffer with at least capacity slots. More... | |
| ~RADRingBuffer () | |
| Destroys elements and releases storage. More... | |
| RADRingBuffer (const RADRingBuffer &other) | |
| Copies another ring buffer in logical order. More... | |
| RADRingBuffer & | operator= (const RADRingBuffer &other) |
| Replaces this buffer with a copy of other. More... | |
| RADRingBuffer (RADRingBuffer &&other) noexcept | |
| Moves another ring buffer without moving individual elements. More... | |
| RADRingBuffer & | operator= (RADRingBuffer &&other) noexcept |
| Replaces this buffer by taking other's storage. More... | |
| iterator | begin () noexcept |
| Returns iterator to the logical first element. More... | |
| iterator | end () noexcept |
| Returns iterator one past the logical last element. More... | |
| const_iterator | begin () const noexcept |
| Returns const iterator to the logical first element. More... | |
| const_iterator | end () const noexcept |
| Returns const iterator one past the logical last element. More... | |
| bool | empty () const noexcept |
| Returns true when no elements are stored. More... | |
| size_t | size () const noexcept |
| Returns number of stored elements. More... | |
| size_t | capacity () const noexcept |
| Returns allocated ring capacity. More... | |
| T & | operator[] (size_t index) noexcept |
| Returns logical element index without bounds checking. More... | |
| const T & | operator[] (size_t index) const noexcept |
| Returns const logical element index without bounds checking. More... | |
| T & | front () noexcept |
| Returns first logical element. More... | |
| const T & | front () const noexcept |
| Returns first logical element. More... | |
| T & | back () noexcept |
| Returns last logical element. More... | |
| const T & | back () const noexcept |
| Returns last logical element. More... | |
| void | reserve (size_t requestedCapacity) |
| Ensures capacity is at least requestedCapacity. More... | |
| template<typename... Args> | |
| T & | emplace_back (Args &&... args) |
| Constructs an element at the logical back. More... | |
| template<typename... Args> | |
| T & | emplace_front (Args &&... args) |
| Constructs an element at the logical front. More... | |
| void | push_back (const T &value) |
| Appends a copy at the back. More... | |
| void | push_back (T &&value) |
| Appends a moved value at the back. More... | |
| void | push_front (const T &value) |
| Prepends a copy at the front. More... | |
| void | push_front (T &&value) |
| Prepends a moved value at the front. More... | |
| void | pop_front () |
| Removes the logical first element. More... | |
| void | pop_back () |
| Removes the logical last element. More... | |
| void | clear () noexcept |
| Destroys all elements while keeping storage. More... | |
Power-of-two circular buffer with push/pop at both ends.
|
inlineexplicit |
Creates a ring buffer with at least capacity slots.
|
inline |
Destroys elements and releases storage.
|
inline |
Copies another ring buffer in logical order.
|
inlinenoexcept |
Moves another ring buffer without moving individual elements.
|
inlinenoexcept |
Returns last logical element.
|
inlinenoexcept |
Returns last logical element.
|
inlinenoexcept |
Returns const iterator to the logical first element.
|
inlinenoexcept |
Returns iterator to the logical first element.
|
inlinenoexcept |
Returns allocated ring capacity.
|
inlinenoexcept |
Destroys all elements while keeping storage.
|
inline |
Constructs an element at the logical back.
|
inline |
Constructs an element at the logical front.
|
inlinenoexcept |
Returns true when no elements are stored.
|
inlinenoexcept |
Returns const iterator one past the logical last element.
|
inlinenoexcept |
Returns iterator one past the logical last element.
|
inlinenoexcept |
Returns first logical element.
|
inlinenoexcept |
Returns first logical element.
|
inline |
Replaces this buffer with a copy of other.
|
inlinenoexcept |
Replaces this buffer by taking other's storage.
|
inlinenoexcept |
Returns const logical element index without bounds checking.
|
inlinenoexcept |
Returns logical element index without bounds checking.
|
inline |
Removes the logical last element.
|
inline |
Removes the logical first element.
|
inline |
Appends a copy at the back.
|
inline |
Appends a moved value at the back.
|
inline |
Prepends a copy at the front.
|
inline |
Prepends a moved value at the front.
|
inline |
Ensures capacity is at least requestedCapacity.
|
inlinenoexcept |
Returns number of stored elements.