16#include <initializer_list>
19#include "pw_containers/inline_deque.h"
23template <
typename T,
typename SizeType,
size_t kCapacity>
24class BasicInlineQueue;
34template <
typename T,
size_t kCapacity = containers::
internal::kGenericSized>
37template <
typename ValueType,
39 size_t kCapacity = containers::internal::kGenericSized>
43 containers::internal::kGenericSized> {
47 containers::internal::kGenericSized>;
50 using typename QueueBase::const_iterator;
51 using typename QueueBase::const_pointer;
52 using typename QueueBase::const_reference;
53 using typename QueueBase::difference_type;
54 using typename QueueBase::iterator;
55 using typename QueueBase::pointer;
56 using typename QueueBase::reference;
57 using typename QueueBase::size_type;
58 using typename QueueBase::value_type;
68 : deque_(constexpr_tag) {}
71 : deque_(count, value) {}
76 typename InputIterator,
77 typename = containers::internal::EnableIfInputIterator<InputIterator>>
79 : deque_(start, finish) {}
91 template <
size_t kOtherCapacity>
103 template <
size_t kOtherCapacity>
106 *
this = std::move(other);
109 template <
typename T,
typename = containers::
internal::EnableIfIterable<T>>
115 BasicInlineQueue& operator=(
const std::initializer_list<value_type>& list) {
116 deque_ = std::move(list);
122 deque_ = other.deque_;
129 template <
size_t kOtherCapacity>
132 deque_ = other.deque_;
138 deque_ = std::move(other.deque_);
145 template <
size_t kOtherCapacity>
148 deque_ = std::move(other.deque_);
152 template <
typename T,
typename = containers::
internal::EnableIfIterable<T>>
161 static constexpr size_type max_size() {
return capacity(); }
162 static constexpr size_type capacity() {
return kCapacity; }
165 template <
typename OtherValueType,
typename OtherSizeType,
size_t kOtherSized>
166 friend class BasicInlineQueue;
172 BasicInlineDeque<ValueType, SizeType>& deque() {
return deque_; }
173 const BasicInlineDeque<ValueType, SizeType>& deque()
const {
return deque_; }
175 BasicInlineDeque<ValueType, SizeType, kCapacity> deque_;
183template <
typename ValueType,
typename SizeType>
186 containers::internal::kGenericSized> {
192 using const_pointer =
typename Deque::const_pointer;
193 using const_reference =
typename Deque::const_reference;
194 using difference_type =
typename Deque::difference_type;
196 using pointer =
typename Deque::pointer;
197 using reference =
typename Deque::reference;
198 using size_type =
typename Deque::size_type;
199 using value_type =
typename Deque::value_type;
203 reference at(size_type index) {
return deque().at(index); }
204 const_reference at(size_type index)
const {
return deque().at(index); }
206 reference operator[](size_type index) {
return deque()[index]; }
207 const_reference operator[](size_type index)
const {
return deque()[index]; }
209 reference front() {
return deque().front(); }
210 const_reference front()
const {
return deque().front(); }
212 reference back() {
return deque().back(); }
213 const_reference back()
const {
return deque().back(); }
215 std::pair<span<const value_type>, span<const value_type>> contiguous_data()
217 return deque().contiguous_data();
219 std::pair<span<value_type>, span<value_type>> contiguous_data() {
220 return deque().contiguous_data();
225 iterator begin()
noexcept {
return deque().begin(); }
226 const_iterator begin()
const noexcept {
return cbegin(); }
227 const_iterator cbegin()
const noexcept {
return deque().cbegin(); }
229 iterator end()
noexcept {
return deque().end(); }
230 const_iterator end()
const noexcept {
return cend(); }
231 const_iterator cend()
const noexcept {
return deque().cend(); }
235 [[nodiscard]]
bool empty()
const noexcept {
return deque().empty(); }
237 [[nodiscard]]
bool full()
const noexcept {
return deque().full(); }
239 size_type size()
const noexcept {
return deque().size(); }
241 size_type max_size()
const noexcept {
return capacity(); }
243 size_type capacity()
const noexcept {
return deque().capacity(); }
247 void clear()
noexcept { deque().clear(); }
249 void push(
const value_type& value) { emplace(value); }
251 void push(value_type&& value) { emplace(std::move(value)); }
253 template <
typename... Args>
254 void emplace(Args&&... args) {
255 deque().emplace_back(std::forward<Args>(args)...);
258 void push_overwrite(
const value_type& value) { emplace_overwrite(value); }
260 void push_overwrite(value_type&& value) {
261 emplace_overwrite(std::move(value));
264 template <
typename... Args>
265 void emplace_overwrite(Args&&... args) {
269 emplace(std::forward<Args>(args)...);
272 void pop() { deque().pop_front(); }
Definition: inline_deque.h:76
Definition: inline_queue.h:186
Definition: inline_queue.h:43
BasicInlineQueue & operator=(BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_queue.h:146
BasicInlineQueue & operator=(const BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_queue.h:130
BasicInlineQueue & operator=(BasicInlineQueue &&other)
Move assigns from matching capacity.
Definition: inline_queue.h:137
BasicInlineQueue & operator=(const BasicInlineQueue &other)
Copy assigns from matching capacity.
Definition: inline_queue.h:121
BasicInlineQueue(BasicInlineQueue &&other)
Move constructs for matching capacity.
Definition: inline_queue.h:98
BasicInlineQueue(BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_queue.h:104
BasicInlineQueue(const BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_queue.h:92
BasicInlineQueue(const BasicInlineQueue &other)
Copy constructs for matching capacity.
Definition: inline_queue.h:86
Definition: inline_deque.h:667
Provides basic helpers for reading and writing UTF-8 encoded strings.
Definition: alignment.h:27
Definition: constexpr_tag.h:46