ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib::static_queue< T, N > Class Template Referenceexport
module lib.queue

A fixed-capacity FIFO queue (circular buffer). More...

Public Types

using size_type = usize
using value_type = T

Public Member Functions

constexpr auto capacity () const noexcept -> size_type
 Returns the capacity of the queue.
constexpr auto clear () noexcept -> void
 Clears the queue.
constexpr auto empty () const noexcept -> bool
 Returns true if the queue is empty.
constexpr auto front () const noexcept -> std::optional< const T & >
 Returns the first element of the queue (const).
constexpr auto front () noexcept -> std::optional< T & >
 Returns the first element of the queue.
constexpr auto full () const noexcept -> bool
 Returns true if the queue is full.
constexpr auto pop () noexcept -> bool
 Removes the first element from the queue.
constexpr auto push (const T &value) noexcept -> bool
 Adds an element to the end of the queue.
constexpr auto push (T &&value) noexcept -> bool
 Adds an element to the end of the queue (move).
constexpr auto size () const noexcept -> size_type
 Returns the number of elements in the queue.

Detailed Description

template<typename T, usize N>
class lib::static_queue< T, N >

A fixed-capacity FIFO queue (circular buffer).

Template Parameters
TType of the elements.
NCapacity of the queue.

Member Function Documentation

◆ pop()

template<typename T, usize N>
auto lib::static_queue< T, N >::pop ( ) ->bool
inlineconstexprexportnoexcept

Removes the first element from the queue.

Returns
true if successful, false if empty.

◆ push() [1/2]

template<typename T, usize N>
auto lib::static_queue< T, N >::push ( const T & value) ->bool
inlineconstexprexportnoexcept

Adds an element to the end of the queue.

Parameters
[in]valueThe value to add.
Returns
true if successful, false if full.

◆ push() [2/2]

template<typename T, usize N>
auto lib::static_queue< T, N >::push ( T && value) ->bool
inlineconstexprexportnoexcept

Adds an element to the end of the queue (move).

Parameters
[in]valueThe value to add.
Returns
true if successful, false if full.

The documentation for this class was generated from the following file: