Provides a raw, contiguous memory based FIFO (first-in, first-out) queue.
raw_queue is a lightweight wrapper over std::queue that exposes additional methods such as capacity control, iterators, reserve, and shrink_to_fit. It is intended as a base class for xtd::collections::generic::queue, providing stack-friendly, high-performance queue operations while maintaining the same interface as std::queue.
| type_t | The type of elements stored in the queue. |
| container_t | The underlying container used to store elements. Defaults to std::deque<type_t>. |
Public Aliases | |
| using | base_type |
| The base STL queue type. | |
| using | container_type |
| The underlying container type. | |
| using | value_type |
| Type of elements stored. | |
| using | size_type |
| Unsigned integer type used for size and capacity. | |
| using | reference |
| Reference to element type. | |
| using | const_reference |
| Const reference to element type. | |
| using | const_iterator |
| Const iterator type. | |
Public Constructors | |
| raw_queue () | |
| Default constructor. Initializes an empty queue. | |
| raw_queue (size_type capacity) | |
| Constructs an empty queue with reserved capacity. | |
| raw_queue (const raw_queue &other) | |
| Copy constructor. | |
| raw_queue (raw_queue &&other) | |
| Move constructor. | |
| template<class input_iterator_t> | |
| raw_queue (input_iterator_t first, input_iterator_t last) | |
| Constructs a queue from a range of iterators. | |
| template<class allocator_t> | |
| raw_queue (const allocator_t &alloc) | |
| Constructs a queue with a specific allocator. | |
Public Properties | |
| auto | begin () const -> const_iterator |
| Gets a const iterator to the beginning of the queue. | |
| auto | capacity () const noexcept -> size_type |
| Gets the reserved capacity of the queue. | |
| auto | cbegin () const -> const_iterator |
| Gets a const iterator to the beginning of the queue. | |
| auto | cend () const -> const_iterator |
| Gets a const iterator to the end of the queue. | |
| auto | end () const -> const_iterator |
| Gets a const iterator to the end of the queue. | |
| auto | items () noexcept -> base_type & |
| Access to the underlying base queue. | |
| auto | items () const noexcept -> const base_type & |
| Access to the underlying base queue. | |
| auto | size () const noexcept -> size_type |
| Gets the number of elements in the queue. | |
Public Methods | |
| auto | clear () -> void |
| Removes all elements from the queue. | |
| auto | push (const value_type &value) -> void |
| Adds a copy of the element at the back of the queue. | |
| auto | push (value_type &&value) -> void |
| Moves the element into the back of the queue. | |
| auto | pop () -> void |
| Removes the element at the front of the queue. | |
| auto | reserve (size_type count) -> void |
Reserves storage to hold at least count elements. | |
| auto | shrink_to_fit () -> void |
| Reduces capacity to fit the current size. | |
Public Operators | |
| raw_queue & | operator= (const raw_queue &other)=default |
| Copy assignment. | |
| raw_queue & | operator= (raw_queue &&other)=default |
| Move assignment. | |
| operator const base_type & () const noexcept | |
| Cast to const base_type. | |
| operator base_type & () noexcept | |
| Cast to base_type. | |
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::base_type |
The base STL queue type.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::container_type |
The underlying container type.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::value_type |
Type of elements stored.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::size_type |
Unsigned integer type used for size and capacity.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::reference |
Reference to element type.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::const_reference |
Const reference to element type.
| using xtd::collections::generic::helpers::raw_queue< type_t, container_t >::const_iterator |
Const iterator type.
|
inline |
Default constructor. Initializes an empty queue.
|
inlineexplicit |
Constructs an empty queue with reserved capacity.
| capacity | The initial capacity to reserve. |
|
inline |
Copy constructor.
|
inline |
Move constructor.
| other | Another raw_queue to move from. |
|
inline |
Constructs a queue from a range of iterators.
| input_iterator_t | Input iterator type. |
| first | Iterator to the first element. |
| last | Iterator past the last element. |
|
inlineexplicit |
Constructs a queue with a specific allocator.
|
inline |
Gets a const iterator to the beginning of the queue.
|
inlinenoexcept |
Gets the reserved capacity of the queue.
|
inline |
Gets a const iterator to the beginning of the queue.
|
inline |
Gets a const iterator to the end of the queue.
|
inline |
Gets a const iterator to the end of the queue.
|
inlinenoexcept |
Access to the underlying base queue.
|
inlinenoexcept |
Access to the underlying base queue.
|
inlinenoexcept |
Gets the number of elements in the queue.
|
inline |
Removes all elements from the queue.
|
inline |
Adds a copy of the element at the back of the queue.
| value | The value to push. |
|
inline |
Moves the element into the back of the queue.
| value | The value to push. |
|
inline |
Removes the element at the front of the queue.
|
inline |
Reserves storage to hold at least count elements.
| count | Number of elements to reserve space for. |
|
inline |
Reduces capacity to fit the current size.
|
default |
Copy assignment.
|
default |
Move assignment.
|
inlinenoexcept |
Cast to const base_type.
|
inlinenoexcept |
Cast to base_type.