LAL: Linear Arrangement Library 24.10.00
A library focused on algorithms on linear arrangements of graphs.
|
Simple array-like fixed-size queue. More...
#include <queue_array.hpp>
Public Member Functions | |
void | init (const std::size_t n) noexcept |
Initializes the queue to hold n elements. | |
void | push (const value_t &v) noexcept |
Insert a new element to the queue. | |
void | push (value_t &&v) noexcept |
Insert a new element to the queue. | |
value_t && | pop () noexcept |
Pops the first element of the queue. | |
value_t & | front () noexcept |
Returns a reference to the front element. | |
const value_t & | front () const noexcept |
Returns a constant reference to the front element. | |
std::size_t | size () const noexcept |
Returns the size of the queue. | |
void | reset () noexcept |
Makes the queue usable again. | |
bool | is_exhausted () const noexcept |
Has the queue exhausted its resources? | |
bool | is_full () const noexcept |
Is the queue full? | |
value_t * | begin () noexcept |
Pointer to begin. | |
const value_t * | begin () const noexcept |
Constant pointer to begin. | |
value_t * | end () noexcept |
Pointer to end. | |
const value_t * | end () const noexcept |
Constant pointer to end. | |
Private Attributes | |
array< value_t > | m_queue |
Data (array) of the queue. | |
std::size_t | m_left |
Left pointer to m_queue. | |
std::size_t | m_right |
Right pointer to m_queue. | |
Simple array-like fixed-size queue.
This class implements functionalities similar to those of std::queue. This queue, however, can hold only at most a given, fixed amount of elements. If the size of the queue is n, then
Once the n push operations have been done, the queue has exhausted its resources (see is_exhausted) and must be reset (see reset).
value_t | Type of the elements in the queue. |
|
inlinenodiscardnoexcept |
Has the queue exhausted its resources?
The queue has exhausted its resources if n pop operations have been performed. This happens when m_left is equal to the queue size.
|
inlinenodiscardnoexcept |
Is the queue full?
The queue is full if n push operations have been performed. This happens when m_right is equal to the queue size.
|
inlinenodiscardnoexcept |
Pops the first element of the queue.
|
inlinenoexcept |