FIFO sequence stored on Base's heap. More...
#include <StormByte/safe/queue.hxx>
Public Types | |
| using | value_type = T |
| Element type. | |
| using | container_type = Vector<T> |
| Underlying Base-owned sequence. | |
| using | size_type = Size |
| Element count. Size, not std::size_t. | |
| using | difference_type = std::ptrdiff_t |
| Iterator distance type. | |
| using | reference = T& |
| Mutable element reference. | |
| using | const_reference = const T& |
| Read-only element reference. | |
| using | iterator = typename Vector<T>::iterator |
| Mutable iterator, front to back. | |
| using | const_iterator = typename Vector<T>::const_iterator |
| Read-only iterator, front to back. | |
Public Member Functions | |
| Queue () noexcept | |
| Construct an empty queue. | |
| STORMBYTE_FORCE_INLINE | Queue (const std::queue< T > &values) |
| Copy a caller-owned STL queue. | |
| STORMBYTE_FORCE_INLINE | Queue (std::queue< T > &&values) |
| Move elements from a caller-owned STL queue and leave it empty. | |
| Queue (const container_type &values) | |
| Copy the underlying sequence. | |
| Queue (container_type &&values) noexcept | |
| Take the underlying sequence. | |
| template<std::ranges::input_range R> requires std::convertible_to<std::ranges::range_reference_t<R>, T> | |
| STORMBYTE_FORCE_INLINE | Queue (std::from_range_t, R &&range) |
Copy the elements of range, in order. | |
| Queue (const Queue &other) | |
| Copy every element into a new Base block. | |
| Queue (Queue &&other) noexcept | |
| Take the block. | |
| ~Queue () noexcept | |
| Destroy every element and release the block. | |
| Queue & | operator= (const Queue &other) |
| Copy-assign. | |
| Queue & | operator= (Queue &&other) noexcept |
| Move-assign. | |
| STORMBYTE_FORCE_INLINE Queue & | operator= (const std::queue< T > &values) |
| Copy-assign a caller-owned STL queue. | |
| STORMBYTE_FORCE_INLINE Queue & | operator= (std::queue< T > &&values) |
| Move-assign a caller-owned STL queue and leave it empty. | |
| iterator | begin () noexcept |
| Return a mutable iterator to the front. | |
| iterator | end () noexcept |
| Return the mutable end iterator. | |
| const_iterator | begin () const noexcept |
| Return a read-only iterator to the front. | |
| const_iterator | end () const noexcept |
| Return the read-only end iterator. | |
| const_iterator | cbegin () const noexcept |
| Return a read-only iterator to the front. | |
| const_iterator | cend () const noexcept |
| Return the read-only end iterator. | |
| bool | empty () const noexcept |
| Test whether the queue is empty. | |
| size_type | size () const noexcept |
| Return the element count. | |
| reference | front () |
| Return the front element. | |
| const_reference | front () const |
| Return the front element. | |
| reference | back () |
| Return the back element. | |
| const_reference | back () const |
| Return the back element. | |
| void | push (const T &value) |
| Append a copy. | |
| void | push (T &&value) |
| Append a moved value. | |
| template<std::ranges::input_range R> requires std::convertible_to<std::ranges::range_reference_t<R>, T> | |
| STORMBYTE_FORCE_INLINE void | push_range (R &&range) |
Append a copy of range, in order. | |
| template<class... Args> | |
| reference | emplace (Args &&... args) |
| Construct an element at the back. | |
| void | pop () |
| Remove the front element. | |
| iterator | erase (const_iterator position) |
| Erase one element. | |
| iterator | erase (const_iterator first, const_iterator last) |
| Erase a half-open range. | |
| void | swap (Queue &other) noexcept |
| Exchange blocks. | |
| bool | operator== (const Queue &other) const |
| Compare elements in FIFO order. | |
| STORMBYTE_FORCE_INLINE std::strong_ordering | operator<=> (const Queue &other) const |
| Order queues lexicographically. | |
| bool | operator< (const Queue &other) const |
| Order queues lexicographically. | |
| bool | operator<= (const Queue &other) const |
| Order queues lexicographically. | |
| bool | operator> (const Queue &other) const |
| Order queues lexicographically. | |
| bool | operator>= (const Queue &other) const |
| Order queues lexicographically. | |
| STORMBYTE_FORCE_INLINE | operator std::queue< T > () const |
| Copy the elements into caller-owned STL storage. | |
FIFO sequence stored on Base's heap.
| T | Safe value. |
Elements live in a Vector. A move from std::queue moves each element and pops the source in the caller, so the deque buffer is released by the caller's CRT. Iterators walk the queue in FIFO order.
| using StormByte::Safe::Queue< T >::const_iterator = typename Vector<T>::const_iterator |
Read-only iterator, front to back.
| using StormByte::Safe::Queue< T >::const_reference = const T& |
Read-only element reference.
| using StormByte::Safe::Queue< T >::container_type = Vector<T> |
Underlying Base-owned sequence.
| using StormByte::Safe::Queue< T >::difference_type = std::ptrdiff_t |
Iterator distance type.
| using StormByte::Safe::Queue< T >::iterator = typename Vector<T>::iterator |
Mutable iterator, front to back.
| using StormByte::Safe::Queue< T >::reference = T& |
Mutable element reference.
| using StormByte::Safe::Queue< T >::size_type = Size |
Element count. Size, not std::size_t.
| using StormByte::Safe::Queue< T >::value_type = T |
Element type.
|
noexcept |
Construct an empty queue.
|
inlineexplicit |
Copy a caller-owned STL queue.
Its state is unchanged.
| values | Source. |
| AllocationError | The block could not be allocated. |
|
inlineexplicit |
Move elements from a caller-owned STL queue and leave it empty.
| values | Source. Empty before this function returns. |
| AllocationError | The block could not be allocated. |
|
explicit |
Copy the underlying sequence.
| values | Source. Unchanged. |
| AllocationError | The block could not be allocated. |
|
explicitnoexcept |
Take the underlying sequence.
values is left empty.
| values | Source. |
|
inlineexplicit |
Copy the elements of range, in order.
| R | Input range of value_type. |
| range | Source. Instantiated in the caller. |
| AllocationError | The block could not be allocated. |
| StormByte::Safe::Queue< T >::Queue | ( | const Queue< T > & | other | ) |
Copy every element into a new Base block.
| other | Source. |
| AllocationError | The block could not be allocated. |
|
noexcept |
Take the block.
other is left empty.
| other | Source. |
|
noexcept |
Destroy every element and release the block.
| reference StormByte::Safe::Queue< T >::back | ( | ) |
Return the back element.
| OutOfBoundsError | The queue is empty. |
| const_reference StormByte::Safe::Queue< T >::back | ( | ) | const |
Return the back element.
| OutOfBoundsError | The queue is empty. |
|
noexcept |
Return a read-only iterator to the front.
|
noexcept |
Return a mutable iterator to the front.
|
noexcept |
Return a read-only iterator to the front.
|
noexcept |
Return the read-only end iterator.
| reference StormByte::Safe::Queue< T >::emplace | ( | Args &&... | args | ) |
Construct an element at the back.
| Args | Constructor argument types. |
| args | Arguments forwarded to T. |
| AllocationError | The block could not be allocated. |
|
noexcept |
Test whether the queue is empty.
|
noexcept |
Return the read-only end iterator.
|
noexcept |
Return the mutable end iterator.
| iterator StormByte::Safe::Queue< T >::erase | ( | const_iterator | first, |
| const_iterator | last ) |
Erase a half-open range.
| first | First element to erase. |
| last | Past-the-end element. |
| iterator StormByte::Safe::Queue< T >::erase | ( | const_iterator | position | ) |
Erase one element.
| position | Element to erase. |
| reference StormByte::Safe::Queue< T >::front | ( | ) |
Return the front element.
| OutOfBoundsError | The queue is empty. |
| const_reference StormByte::Safe::Queue< T >::front | ( | ) | const |
Return the front element.
| OutOfBoundsError | The queue is empty. |
|
inlineexplicit |
Copy the elements into caller-owned STL storage.
| bool StormByte::Safe::Queue< T >::operator< | ( | const Queue< T > & | other | ) | const |
Order queues lexicographically.
| other | Queue to compare. |
other. | bool StormByte::Safe::Queue< T >::operator<= | ( | const Queue< T > & | other | ) | const |
Order queues lexicographically.
| other | Queue to compare. |
other. | STORMBYTE_FORCE_INLINE std::strong_ordering StormByte::Safe::Queue< T >::operator<=> | ( | const Queue< T > & | other | ) | const |
| Queue & StormByte::Safe::Queue< T >::operator= | ( | const Queue< T > & | other | ) |
Copy-assign.
| other | Source. |
| AllocationError | The block could not be allocated. |
|
inline |
Copy-assign a caller-owned STL queue.
Its state is unchanged.
| values | Source. |
| AllocationError | The block could not be allocated. |
|
noexcept |
Move-assign.
other is left empty.
| other | Source. |
|
inline |
Move-assign a caller-owned STL queue and leave it empty.
| values | Source. Empty before this function returns. |
| AllocationError | The block could not be allocated. |
| bool StormByte::Safe::Queue< T >::operator== | ( | const Queue< T > & | other | ) | const |
Compare elements in FIFO order.
| other | Queue to compare. |
| bool StormByte::Safe::Queue< T >::operator> | ( | const Queue< T > & | other | ) | const |
Order queues lexicographically.
| other | Queue to compare. |
other. | bool StormByte::Safe::Queue< T >::operator>= | ( | const Queue< T > & | other | ) | const |
Order queues lexicographically.
| other | Queue to compare. |
other. | void StormByte::Safe::Queue< T >::pop | ( | ) |
Remove the front element.
| OutOfBoundsError | The queue is empty. |
| void StormByte::Safe::Queue< T >::push | ( | const T & | value | ) |
Append a copy.
| value | Value to copy. |
| AllocationError | The block could not be allocated. |
| void StormByte::Safe::Queue< T >::push | ( | T && | value | ) |
Append a moved value.
| value | Value to move. |
| AllocationError | The block could not be allocated. |
|
inline |
Append a copy of range, in order.
| R | Input range of value_type. |
| range | Source. Instantiated in the caller. |
| AllocationError | The block could not be allocated. |
|
noexcept |
Return the element count.
|
noexcept |