42 template<
class type_t,
class container_t = std::deque<type_t>>
43 class raw_queue final :
public std::queue<type_t, container_t> {
84 template<
class input_iterator_t>
88 template<
class allocator_t>
131 auto clear() ->
void {base_type::c.clear();}
137 base_type::push(value);
138 ensure_capacity(base_type::c.
size());
145 base_type::push(std::move(value));
146 ensure_capacity(base_type::c.
size());
153 ensure_capacity(
size());
160 if (capacity_ >= count)
return;
161 ensure_capacity(count);
167 base_type::c.shrink_to_fit();
168 capacity_ = base_type::c.size();
185 auto original_size = base_type::size();
186 base_type::c.resize(capacity_);
187 base_type::c.resize(original_size);
196 template<
class container_t>
197 raw_queue(container_t) -> raw_queue<typename container_t::value_type, container_t>;
199 template<
class container_t,
class allocator_t>
200 raw_queue(container_t, allocator_t) -> raw_queue<typename container_t::value_type, container_t>;
202 template<
class input_iterator_t>
203 raw_queue(input_iterator_t, input_iterator_t) -> raw_queue<typename std::iterator_traits<input_iterator_t>::value_type>;
205 template<
class input_iterator_t,
class allocator_t>
206 raw_queue(input_iterator_t, input_iterator_t, allocator_t) -> raw_queue<typename std::iterator_traits<input_iterator_t>::value_type, std::deque<typename std::iterator_traits<input_iterator_t>::value_type, allocator_t>>;
auto clear() -> void
Removes all elements from the queue.
Definition raw_queue.hpp:131
auto capacity() const noexcept -> size_type
Definition raw_queue.hpp:101
typename base_type::size_type size_type
Unsigned integer type used for size and capacity.
Definition raw_queue.hpp:51
auto pop() -> void
Removes the element at the front of the queue.
Definition raw_queue.hpp:151
raw_queue & operator=(raw_queue &&other)=default
Move assignment.
auto cend() const -> const_iterator
Gets a const iterator to the end of the queue.
Definition raw_queue.hpp:109
auto shrink_to_fit() -> void
Reduces capacity to fit the current size.
Definition raw_queue.hpp:166
raw_queue & operator=(const raw_queue &other)=default
Copy assignment.
auto push(const value_type &value) -> void
Adds a copy of the element at the back of the queue.
Definition raw_queue.hpp:136
auto size() const noexcept -> size_type
Gets the number of elements in the queue.
Definition raw_queue.hpp:124
auto items() const noexcept -> const base_type &
Access to the underlying base queue.
Definition raw_queue.hpp:120
std::queue< type_t, container_t > base_type
The base STL queue type.
Definition raw_queue.hpp:48
raw_queue()
Default constructor. Initializes an empty queue.
Definition raw_queue.hpp:62
auto end() const -> const_iterator
Gets a const iterator to the end of the queue.
Definition raw_queue.hpp:113
auto push(value_type &&value) -> void
Moves the element into the back of the queue.
Definition raw_queue.hpp:144
raw_queue(size_type capacity)
Constructs an empty queue with reserved capacity.
Definition raw_queue.hpp:67
typename base_type::container_type container_type
The underlying container type.
Definition raw_queue.hpp:49
auto items() noexcept -> base_type &
Access to the underlying base queue.
Definition raw_queue.hpp:117
raw_queue(input_iterator_t first, input_iterator_t last)
Constructs a queue from a range of iterators.
Definition raw_queue.hpp:85
auto cbegin() const -> const_iterator
Gets a const iterator to the beginning of the queue.
Definition raw_queue.hpp:105
auto reserve(size_type count) -> void
Reserves storage to hold at least count elements.
Definition raw_queue.hpp:159
raw_queue(const raw_queue &other)
Copy constructor.
Definition raw_queue.hpp:73
typename base_type::reference reference
Reference to element type.
Definition raw_queue.hpp:52
raw_queue(const allocator_t &alloc)
Constructs a queue with a specific allocator.
Definition raw_queue.hpp:89
raw_queue(raw_queue &&other)
Move constructor.
Definition raw_queue.hpp:78
typename container_type::const_iterator const_iterator
Const iterator type.
Definition raw_queue.hpp:54
typename base_type::value_type value_type
Type of elements stored.
Definition raw_queue.hpp:50
auto begin() const -> const_iterator
Gets a const iterator to the beginning of the queue.
Definition raw_queue.hpp:97
typename base_type::const_reference const_reference
Const reference to element type.
Definition raw_queue.hpp:53
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
@ other
The operating system is other.
Definition platform_id.hpp:60
The xtd::collections::generic::helpers namespace contains helpers for generic collections,...
Definition allocator.hpp:14
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307