An STL-like ring buffer with dynamic allocation and compile-time capacity limits.
More...
|
|
using | allocator_type = Allocator |
| |
|
using | alloc_traits = std::allocator_traits< allocator_type > |
| |
|
using | value_type = Elem |
| |
|
using | pointer = typename alloc_traits::pointer |
| |
|
using | const_pointer = typename alloc_traits::const_pointer |
| |
|
using | reference = decltype(*pointer{}) |
| |
|
using | const_reference = decltype(*const_pointer{}) |
| |
|
using | iterator = detail::ringbuf::Iterator< pointer, alloc_traits, Capacity > |
| |
|
using | const_iterator = detail::ringbuf::Iterator< const_pointer, alloc_traits, Capacity > |
| |
|
using | reverse_iterator = std::reverse_iterator< iterator > |
| |
|
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
| |
|
using | difference_type = typename alloc_traits::difference_type |
| |
|
using | size_type = typename alloc_traits::size_type |
| |
|
using | unsigned_difference = typename std::make_unsigned< difference_type >::type |
| |
|
using | self = RingBuf< Elem, Capacity > |
| |
|
| | RingBuf () |
| | Construct a new ring buffer object with a default-constructed allocator, and allocate the required memory. More...
|
| |
| | RingBuf (const allocator_type &allocator) |
| | Construct a new ring buffer object with the provided allocator, and allocate the required memory. More...
|
| |
| | ~RingBuf () |
| | Destroy the ring buffer object. More...
|
| |
| | RingBuf (const RingBuf &other) |
| | Construct a new RingBuf object out of another, using elementwise copy assignment. More...
|
| |
| | RingBuf (const RingBuf &other, const allocator_type &allocator) |
| | Allocator-extended copy constructor. More...
|
| |
| | RingBuf (RingBuf &&other) noexcept |
| | Construct a new RingBuf object out of another, using bulk move assignment. More...
|
| |
| | RingBuf (RingBuf &&other, const allocator_type &allocator) |
| | Allocator-extended move constructor. More...
|
| |
| RingBuf & | operator= (const RingBuf &other) |
| | Copy a RingBuf into this one. More...
|
| |
| RingBuf & | operator= (RingBuf &&other) noexcept(alloc_traits::propagate_on_container_move_assignment::value||std::is_nothrow_move_constructible< value_type >::value) |
| | Move a RingBuf into this one. More...
|
| |
|
allocator_type | get_allocator () const |
| | Get a copy of the allocator used by this RingBuf.
|
| |
| reference | front () |
| | Returns the first element in the ring buffer. More...
|
| |
| const_reference | front () const |
| | Returns the first element in the ring buffer. More...
|
| |
| reference | back () |
| | Returns he last element in the ring buffer. More...
|
| |
| const_reference | back () const |
| | Returns he last element in the ring buffer. More...
|
| |
| const_reference | operator[] (const size_type index) const |
| | Retrieve an element from the ring buffer without range checking. More...
|
| |
| reference | operator[] (const size_type index) |
| | Retrieve an element from the ring buffer without range checking. More...
|
| |
| const_reference | at (const size_type index) const |
| | Retrieve an element from the ring buffer with range checking. More...
|
| |
| reference | at (const size_type index) |
| | Retrieve an element from the ring buffer with range checking. More...
|
| |
|
iterator | begin () noexcept |
| | Get an iterator pointing to the first element.
|
| |
|
iterator | end () noexcept |
| | Get an iterator pointing to one past the last element.
|
| |
|
const_iterator | begin () const noexcept |
| | Get a const iterator pointing to the first element.
|
| |
|
const_iterator | end () const noexcept |
| | Get a const iterator pointing to one past the last element.
|
| |
|
const_iterator | cbegin () const noexcept |
| | Get a const iterator pointing to the first element.
|
| |
|
const_iterator | cend () const noexcept |
| | Get a const iterator pointing to one past the last element.
|
| |
|
reverse_iterator | rbegin () noexcept |
| | Get a reverse iterator pointing to the last element.
|
| |
|
reverse_iterator | rend () noexcept |
| | Get a reverse iterator pointing to one before the first element.
|
| |
|
const_reverse_iterator | rbegin () const noexcept |
| | Get a const reverse iterator pointing to the last element.
|
| |
|
const_reverse_iterator | rend () const noexcept |
| | Get a const reverse iterator pointing to one before the first element.
|
| |
|
const_reverse_iterator | crbegin () const noexcept |
| | Get a const reverse iterator pointing to the last element.
|
| |
|
const_reverse_iterator | crend () const noexcept |
| | Get a const reverse iterator pointing to one before the first element.
|
| |
|
bool | empty () const noexcept |
| | Get whether the ring buffer is empty (size() == 0)
|
| |
|
size_type | size () const noexcept |
| | Get the number of elements in the ring buffer.
|
| |
|
constexpr size_type | max_size () const noexcept |
| | Get the maximum number of elements in this ring buffer (Capacity).
|
| |
| void | push_front (const_reference value) |
| | Push a new element at the front of the ring buffer, popping the back if necessary. More...
|
| |
| void | push_front (value_type &&value) |
| | Push a new element at the front of the ring buffer, popping the back if necessary. More...
|
| |
| template<typename... Args> |
| reference | emplace_front (Args &&... args) |
| | Construct a new element in-place before the front of the ring buffer, popping the back if necessary. More...
|
| |
| void | push_back (const_reference value) |
| | Push a new element into the ring buffer, popping the front if necessary. More...
|
| |
| void | push_back (value_type &&value) |
| | Push a new element into the ring buffer, popping the front if necessary. More...
|
| |
| template<typename... Args> |
| reference | emplace_back (Args &&... args) |
| | Construct a new element in-place at the end of the ring buffer, popping the front if necessary. More...
|
| |
|
void | pop_front () noexcept |
| | Pop an element off the front, destroying the first element in the ring buffer.
|
| |
|
void | pop_back () noexcept |
| | Pop an element off the back, destroying the last element in the ring buffer.
|
| |
| void | clear () noexcept(noexcept(pop_front())) |
| | Remove all elements from the ring buffer, destroying each one starting at the front. More...
|
| |
| iterator | erase (const_iterator from, const_iterator to) noexcept(noexcept(pop_front()) &&std::is_nothrow_move_assignable< Elem >::value) |
| | Erase elements in the range [first, last). More...
|
| |
| iterator | erase (const_iterator pos) noexcept(noexcept(erase(pos, pos+1))) |
| | Erase an element. More...
|
| |
| void | swap (RingBuf &other) noexcept |
| | Swap this ring buffer with another using std::swap. More...
|
| |
template<typename Elem, std::size_t Capacity, typename Allocator = std::allocator<Elem>>
class baudvine::RingBuf< Elem, Capacity, Allocator >
An STL-like ring buffer with dynamic allocation and compile-time capacity limits.
- Template Parameters
-
| Elem | The type of elements contained by the ring buffer. |
| Capacity | The maximum size of the ring buffer, and the fixed size of the backing array. |
| Allocator | The allocator type to use for storage and element construction. |
Definition at line 337 of file ringbuf.h.