Luna::RingDeque
A container that implements a double-ended queue and uses a ring buffer as its internal storage.
template <typename _Ty, typename _Alloc>
class Luna::RingDeque
Parameters
-
_Ty
The element type of the container.
-
_Alloc
The memory allocator used by the container. If not specified, Allocator will be used.
Member functions
-
Gets one iterator to the first element of the queue.
-
Gets one iterator to the one past last element of the queue.
-
Gets one constant iterator to the first element of the queue.
-
Gets one constant iterator to the one past last element of the queue.
-
Gets one constant iterator to the first element of the queue.
-
Gets one constant iterator to the one past last element of the queue.
-
Gets one reverse iterator to the last element of the queue.
-
Gets one reverse iterator to the one-before-first element of the queue.
-
const_reverse_iterator rbegin() const
Gets one constant reverse iterator to the last element of the queue.
-
const_reverse_iterator rend() const
Gets one constant reverse iterator to the one-before-first element of the queue.
-
const_reverse_iterator crbegin() const
Gets one constant reverse iterator to the last element of the queue.
-
const_reverse_iterator crend() const
Gets one constant reverse iterator to the one-before-first element of the queue.
-
Gets the size of the queue, that is, the number of elements in the queue.
-
Gets the capacity of the queue, that is, the maximum number of elements this queue can hold before next expansion.
-
Checks whether this queue is empty, that is, the size of this queue is
0
. -
Constructs an empty queue.
-
RingDeque(const allocator_type &alloc)
Constructs an empty queue with an custom allocator.
-
RingDeque(const RingDeque &rhs)
Constructs a queue by copying elements from another queue.
-
RingDeque(const RingDeque &rhs, const allocator_type &alloc)
Constructs a queue with an custom allocator and with elements copied from another queue.
-
Constructs a queue by moving elements from another queue.
-
RingDeque(RingDeque &&rhs, const allocator_type &alloc)
Constructs a queue with an custom allocator and with elements moved from another queue.
-
RingDeque & operator=(const RingDeque &rhs)
Replaces elements of the queue by coping elements from another queue.
-
RingDeque & operator=(RingDeque &&rhs)
Replaces elements of the queue by moving elements from another queue.
-
Increases the capacity of the queue to a value greater than or equal to
new_cap
, so that it can hold at leastnew_cap
elements without reallocating the internal buffer. -
Resizes the queue.
-
void resize(usize n, const value_type &v)
Resizes the queue.
-
Gets the element at the specified index.
-
const_reference operator[](usize n) const
Gets the element at the specified index.
-
Gets the element at the specified index.
-
const_reference at(usize n) const
Gets the element at the specified index.
-
Gets the element at the front of the queue.
-
Gets the element at the front of the queue.
-
Gets the element at the back of the queue.
-
Gets the element at the back of the queue.
-
Removes all elements from the queue, but keeps the queue storage.
-
void push_back(const value_type &val)
Pushes one element to the back of the queue.
-
void push_back(value_type &&val)
Pushes one element to the back of the queue.
-
Removes the element from the back of the queue.
-
void push_front(const value_type &val)
Pushes one element at the front of the queue.
-
void push_front(value_type &&val)
Pushes one element at the front of the queue.
-
Removes the element at the front of the queue.
-
void assign(usize count, const value_type &value)
Replaces elements of the queue by several copies of the specified value.
-
auto assign(_InputIter first, _InputIter last) -> enable_if_t<!is_integral_v< _InputIter >, void >
Replaces elements of the queue by elements specified by one range. Elements in the range will be copy-inserted into the queue.
-
void assign(InitializerList< value_type > il)
Replaces elements of the queue by elements from one initializer queue.
-
iterator insert(const_iterator pos, const value_type &value)
Inserts the specified element to the queue.
-
iterator insert(const_iterator pos, value_type &&value)
Inserts the specified element to the queue.
-
iterator insert(const_iterator pos, usize count, const value_type &value)
Inserts several copies of the element to the queue.
-
Inserts one range of elements to the queue.
-
iterator insert(const_iterator pos, InitializerList< value_type > ilist)
Inserts one range of elements specified by the initializer list to the queue.
-
iterator erase(const_iterator pos)
Removes one element from the queue.
-
iterator erase(const_iterator first, const_iterator last)
Removes one range of elements from the queue.
-
Swaps elements of this queue with the specified queue.
-
iterator emplace(const_iterator pos, _Args &&... args)
Constructs one element directly on the specified position of the queue using the provided arguments.
-
iterator emplace_back(_Args &&... args)
Constructs one element directly on the back of the queue using the provided arguments.
-
iterator emplace_front(_Args &&... args)
Constructs one element directly on the front of the queue using the provided arguments.
-
allocator_type get_allocator() const
Gets the allocator of the queue.