|
LAL: Linear Arrangement Library 23.01.00
A library focused on algorithms on linear arrangements of graphs.
|
Simple array-like fixed-size queue. More...
#include <linear_queue.hpp>
Public Member Functions | |
| void | init (std::size_t n) noexcept |
| Initializes the queue to hold n elements. | |
| void | push (const T &v) noexcept |
| Insert a new element to the queue. | |
| void | push (T &&v) noexcept |
| Insert a new element to the queue. | |
| T && | pop () noexcept |
| Pops the first element of the queue. More... | |
| T & | front () noexcept |
| Returns a reference to the front element. | |
| const 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. More... | |
| bool | is_exhausted () const noexcept |
| Has the queue exhausted its resources? More... | |
| bool | is_full () const noexcept |
| Is the queue full? More... | |
| T * | begin () noexcept |
| Pointer to begin. | |
| const T * | begin () const noexcept |
| Constant pointer to begin. | |
| T * | end () noexcept |
| Pointer to end. | |
| const T * | end () const noexcept |
| Constant pointer to end. | |
Private Attributes | |
| data_array< 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).
| T | Type of the elements in the queue. |
|
inlinenoexcept |
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.
|
inlinenoexcept |
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.
|
inlinenoexcept |
Pops the first element of the queue.
|
inlinenoexcept |