75 m_data[i_l] = other.m_data[i_l];
102 other.m_size_max = 0;
112 if (
this != std::addressof(other)) {
122 m_data[i_l] = other.m_data[i_l];
136 if (
this != std::addressof(other)) {
137 m_data = std::move(other.m_data );
138 m_head = std::move(other.m_head );
139 m_count = std::move(other.m_count );
146 other.m_size_max = 0;
191 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
202 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
213 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
224 if (pos >=
m_count)
throw std::invalid_argument(
"Invalid subscript");
237 if (pos >=
m_size_max)
throw std::invalid_argument(
"Invalid subscript");
250 if (pos >=
m_size_max)
throw std::invalid_argument(
"Invalid subscript");
287 m_data[pos] = std::move(v);
292 m_data[pos] = std::move(v);
303 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
344 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
354 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
363 if (!
m_count)
throw std::invalid_argument(
"Empty storage");
396 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.h:15
vector_queue< value_type > & operator=(const vector_queue< value_type > &other)
Copies existing queue.
Definition: vector_queue.h:110
const T * const_pointer
Constant pointer to element.
Definition: vector_queue.h:45
bool empty() const
Tests if the queue is empty.
Definition: vector_queue.h:179
size_type tail() const
Returns absolute subscript or position number of the last element in the queue. The element must exis...
Definition: vector_queue.h:394
reference operator[](size_type pos)
Returns a reference to the element at a specified location in the queue.
Definition: vector_queue.h:200
vector_queue(const vector_queue< value_type > &other)
Copies existing queue.
Definition: vector_queue.h:66
value_type * m_data
Underlying data container.
Definition: vector_queue.h:408
size_t size_type
Type to measure element count and indices in.
Definition: vector_queue.h:20
T & reference
Reference to element type.
Definition: vector_queue.h:30
const_reference back() const
Returns a constant reference to the last element in the queue.
Definition: vector_queue.h:378
vector_queue(vector_queue< value_type > &&other)
Moves existing queue.
Definition: vector_queue.h:92
reference back()
Returns a reference to the last element in the queue.
Definition: vector_queue.h:370
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.h:283
size_type head() const
Returns absolute subscript or position number of the head element in the queue. The element does not ...
Definition: vector_queue.h:386
size_type m_count
Number of elements.
Definition: vector_queue.h:410
virtual ~vector_queue()
Destroys the queue.
Definition: vector_queue.h:82
reference front()
Returns a reference to the head element in the queue.
Definition: vector_queue.h:352
size_type m_size_max
Maximum size.
Definition: vector_queue.h:411
vector_queue< value_type > & operator=(vector_queue< value_type > &&other)
Moves existing queue.
Definition: vector_queue.h:134
reference at_abs(size_type pos)
Returns a reference to the element at the absolute location in the queue.
Definition: vector_queue.h:235
void clear()
Erases the elements of the queue.
Definition: vector_queue.h:171
const_reference front() const
Returns a constant reference to the head element in the queue.
Definition: vector_queue.h:361
vector_queue(size_type size_max)
Construct queue of fixed size.
Definition: vector_queue.h:53
T value_type
Element type.
Definition: vector_queue.h:25
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.h:261
void pop_back()
Removes (dequeues) the last element of the queue.
Definition: vector_queue.h:301
size_type m_head
Index of the first element.
Definition: vector_queue.h:409
T * pointer
Pointer to element.
Definition: vector_queue.h:40
const_reference at(size_type pos) const
Returns a constant reference to the element at a specified location in the queue.
Definition: vector_queue.h:211
const_reference operator[](size_type pos) const
Returns a constant reference to the element at a specified location in the queue.
Definition: vector_queue.h:222
size_type size() const
Returns the number of elements in the vector.
Definition: vector_queue.h:155
void pop_front()
Removes (dequeues) the head element of the queue.
Definition: vector_queue.h:342
size_type capacity() const
Returns the number of elements that the queue can contain before overwriting head ones.
Definition: vector_queue.h:163
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.h:314
reference at(size_type pos)
Returns a reference to the element at a specified location in the queue.
Definition: vector_queue.h:189
size_type abs(size_type pos) const
Returns absolute subscript or position number of the given element in the queue.
Definition: vector_queue.h:402
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.h:330
const T & const_reference
Constant reference to element type.
Definition: vector_queue.h:35
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.h:248