77 m_data[i_l] = other.m_data[i_l];
104 other.m_size_max = 0;
114 if (
this != std::addressof(other)) {
124 m_data[i_l] = other.m_data[i_l];
138 if (
this != std::addressof(other)) {
139 m_data = std::move(other.m_data );
140 m_head = std::move(other.m_head );
141 m_count = std::move(other.m_count );
148 other.m_size_max = 0;
193 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
204 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
215 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
226 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
239 if (pos >=
m_size_max)
throw std::invalid_argument(
"Invalid subscript");
252 if (pos >=
m_size_max)
throw std::invalid_argument(
"Invalid subscript");
289 m_data[pos] = std::move(v);
294 m_data[pos] = std::move(v);
305 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
346 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
356 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
365 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
398 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
Helper class to allow limited size FIFO queues implemented as vector of elements.
Definition vector_queue.hpp:17
vector_queue< value_type > & operator=(const vector_queue< value_type > &other)
Copies existing queue.
Definition vector_queue.hpp:112
const T * const_pointer
Constant pointer to element.
Definition vector_queue.hpp:47
bool empty() const
Tests if the queue is empty.
Definition vector_queue.hpp:181
size_type tail() const
Returns absolute subscript or position number of the last element in the queue. The element must exis...
Definition vector_queue.hpp:396
reference operator[](size_type pos)
Returns a reference to the element at a specified location in the queue.
Definition vector_queue.hpp:202
vector_queue(const vector_queue< value_type > &other)
Copies existing queue.
Definition vector_queue.hpp:68
value_type * m_data
Underlying data container.
Definition vector_queue.hpp:411
size_t size_type
Type to measure element count and indices in.
Definition vector_queue.hpp:22
T & reference
Reference to element type.
Definition vector_queue.hpp:32
const_reference back() const
Returns a constant reference to the last element in the queue.
Definition vector_queue.hpp:380
vector_queue(vector_queue< value_type > &&other)
Moves existing queue.
Definition vector_queue.hpp:94
reference back()
Returns a reference to the last element in the queue.
Definition vector_queue.hpp:372
size_type push_back(value_type &&v)
Moves the element to the end of the queue, overriding the first one when queue is out of space.
Definition vector_queue.hpp:285
size_type head() const
Returns absolute subscript or position number of the head element in the queue. The element does not ...
Definition vector_queue.hpp:388
size_type m_count
Number of elements.
Definition vector_queue.hpp:413
virtual ~vector_queue()
Destroys the queue.
Definition vector_queue.hpp:84
reference front()
Returns a reference to the head element in the queue.
Definition vector_queue.hpp:354
size_type m_size_max
Maximum size.
Definition vector_queue.hpp:414
vector_queue< value_type > & operator=(vector_queue< value_type > &&other)
Moves existing queue.
Definition vector_queue.hpp:136
reference at_abs(size_type pos)
Returns a reference to the element at the absolute location in the queue.
Definition vector_queue.hpp:237
void clear()
Erases the elements of the queue.
Definition vector_queue.hpp:173
const_reference front() const
Returns a constant reference to the head element in the queue.
Definition vector_queue.hpp:363
vector_queue(size_type size_max)
Construct queue of fixed size.
Definition vector_queue.hpp:55
T value_type
Element type.
Definition vector_queue.hpp:27
size_type push_back(const value_type &v)
Copies an existing element to the end of the queue, overriding the first one when queue is out of spa...
Definition vector_queue.hpp:263
void pop_back()
Removes (dequeues) the last element of the queue.
Definition vector_queue.hpp:303
size_type m_head
Index of the first element.
Definition vector_queue.hpp:412
T * pointer
Pointer to element.
Definition vector_queue.hpp:42
const_reference at(size_type pos) const
Returns a constant reference to the element at a specified location in the queue.
Definition vector_queue.hpp:213
const_reference operator[](size_type pos) const
Returns a constant reference to the element at a specified location in the queue.
Definition vector_queue.hpp:224
size_type size() const
Returns the number of elements in the vector.
Definition vector_queue.hpp:157
void pop_front()
Removes (dequeues) the head element of the queue.
Definition vector_queue.hpp:344
size_type capacity() const
Returns the number of elements that the queue can contain before overwriting head ones.
Definition vector_queue.hpp:165
size_type push_front(const value_type &v)
Copies an existing element to the head of the queue, overriding the last one when queue is out of spa...
Definition vector_queue.hpp:316
reference at(size_type pos)
Returns a reference to the element at a specified location in the queue.
Definition vector_queue.hpp:191
size_type abs(size_type pos) const
Returns absolute subscript or position number of the given element in the queue.
Definition vector_queue.hpp:405
size_type push_front(value_type &&v)
Moves the element to the head of the queue, overriding the last one when queue is out of space and mo...
Definition vector_queue.hpp:332
const T & const_reference
Constant reference to element type.
Definition vector_queue.hpp:37
const_reference at_abs(size_type pos) const
Returns a constant reference to the element at the absolute location in the queue: measured from the ...
Definition vector_queue.hpp:250