MT Core (C++)
Core library for replacing C++ standard in project usage
|
Statically allocated FIFO queue with fixed maximum capacity. More...
#include <queue.hpp>
Public Member Functions | |
Result< void, AllocationError > | init () |
Initializes Queue with capacity. | |
Result< void, AllocationError > | init (std::initializer_list< T > init) |
Initializes Queue with initial items. | |
size_t | size () const noexcept |
size_t | capacity () const noexcept |
Optional< T > | peek () const noexcept |
Peeks at first element of Queue. | |
Optional< T > | pop () noexcept |
Removes and returns the next element in the Queue. | |
Result< void, CollectionAddNoAllocationError > | push (const T &elem) noexcept |
Tries to add an element to the Queue Fails if Queue is empty. | |
bool | is_full () const noexcept |
Checks if ring buffer is full. | |
bool | is_empty () const noexcept |
Checks if ring buffer is empty. | |
Statically allocated FIFO queue with fixed maximum capacity.
T | Element to store |
Capacity | Maximum capacity of queue |
Adding elements is \(O(1)\) Removing elements is \(O(1)\)
|
inlinenodiscardnoexcept |
Definition at line 182 of file queue.hpp.
|
inline |
|
inline |
Initializes Queue with initial items.
init | Initial elements |
Definition at line 172 of file queue.hpp.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Removes and returns the next element in the Queue.
Definition at line 199 of file queue.hpp.
|
inlinenoexcept |
|
inlinenodiscardnoexcept |