template<typename T, typename SizeType = uint16_t>
class pw::DynamicQueue< T, SizeType >
A queue implementation backed by pw::DynamicDeque.
This class provides a std::queue-like interface but uses a Pigweed allocator for dynamic memory management. It includes fallible try_* operations for scenarios where allocation failure may be handled gracefully.
- Template Parameters
-
| T | The type of elements stored in the queue. |
|
|
using | const_iterator = typename Deque::const_iterator |
| |
|
using | const_pointer = typename Deque::const_pointer |
| |
|
using | const_reference = typename Deque::const_reference |
| |
|
using | difference_type = typename Deque::difference_type |
| |
|
using | iterator = typename Deque::iterator |
| |
|
using | pointer = typename Deque::pointer |
| |
|
using | reference = typename Deque::reference |
| |
|
using | size_type = typename Deque::size_type |
| |
|
using | value_type = typename Deque::value_type |
| |
|
using | const_iterator = typename Deque::const_iterator |
| |
|
using | const_pointer = typename Deque::const_pointer |
| |
|
using | const_reference = typename Deque::const_reference |
| |
|
using | difference_type = typename Deque::difference_type |
| |
|
using | iterator = typename Deque::iterator |
| |
|
using | pointer = typename Deque::pointer |
| |
|
using | reference = typename Deque::reference |
| |
|
using | size_type = typename Deque::size_type |
| |
|
using | value_type = typename Deque::value_type |
| |
|
|
constexpr | DynamicQueue (pw::Allocator &allocator) |
| | Constructs a DynamicQueue using the provided allocator.
|
| |
|
| DynamicQueue (const DynamicQueue &)=delete |
| |
|
DynamicQueue & | operator= (const DynamicQueue &)=delete |
| |
|
constexpr | DynamicQueue (DynamicQueue &&)=default |
| | Move operations are supported and incur no allocations.
|
| |
|
DynamicQueue & | operator= (DynamicQueue &&)=default |
| |
|
bool | try_push (const value_type &value) |
| | Attempts to add an element to the back of the queue.
|
| |
|
bool | try_push (value_type &&value) |
| | Attempts to add an element to the back of the queue (move version).
|
| |
|
template<typename... Args> |
| bool | try_emplace (Args &&... args) |
| | Attempts to construct an element in place at the back of the queue.
|
| |
|
void | reserve (size_type capacity) |
| | Sets the queue capacity to at least max(capacity, size()) elements.
|
| |
| bool | try_reserve (size_type capacity) |
| |
|
void | reserve_exact (size_type capacity) |
| | Sets the queue capacity to max(capacity, size()) elements.
|
| |
|
bool | try_reserve_exact (size_type capacity) |
| | Attempts to set the queue capacity to max(capacity, size()) elements.
|
| |
|
void | shrink_to_fit () |
| | Reduces memory usage by releasing unused capacity, if possible.
|
| |
|
void | swap (DynamicQueue &other) |
| | Swaps the contents with another queue.
|
| |
|
reference | front () |
| |
|
const_reference | front () const |
| |
|
reference | back () |
| |
|
const_reference | back () const |
| |
|
bool | empty () const noexcept |
| |
|
constexpr bool | full () const noexcept |
| |
|
size_type | size () const noexcept |
| |
|
size_type | max_size () const noexcept |
| |
|
size_type | capacity () const noexcept |
| |
|
void | clear () |
| | Removes all elements from the queue.
|
| |
|
void | push (const value_type &value) |
| |
|
void | push (value_type &&value) |
| |
|
template<typename... Args> |
| void | emplace (Args &&... args) |
| |
|
void | pop () |
| |