16#include <initializer_list>
19#include "pw_containers/inline_deque.h"
20#include "pw_containers/internal/generic_queue.h"
23namespace containers::internal {
25template <
typename Derived,
typename Deque>
26class BasicInlineQueueImpl;
35template <
typename T,
typename SizeType,
size_t kCapacity>
36class BasicInlineQueue;
46template <
typename T,
size_t kCapacity = containers::
internal::kGenericSized>
49template <
typename ValueType,
51 size_t kCapacity = containers::internal::kGenericSized>
57 containers::internal::kGenericSized>
63 containers::internal::kGenericSized>;
66 using typename Base::const_iterator;
67 using typename Base::const_pointer;
68 using typename Base::const_reference;
69 using typename Base::difference_type;
70 using typename Base::iterator;
71 using typename Base::pointer;
72 using typename Base::reference;
73 using typename Base::size_type;
74 using typename Base::value_type;
84 : deque_(constexpr_tag) {}
87 : deque_(count, value) {}
92 typename InputIterator,
93 typename = containers::internal::EnableIfInputIterator<InputIterator>>
95 : deque_(start, finish) {}
106 template <
size_t kOtherCapacity>
114 : deque_(std::move(other.deque_)) {}
119 template <
size_t kOtherCapacity>
122 *
this = std::move(other);
125 template <
typename T,
typename = containers::
internal::EnableIfIterable<T>>
128 BasicInlineQueue& operator=(
const std::initializer_list<value_type>& list) {
129 deque_ = std::move(list);
135 deque_ = other.deque_;
142 template <
size_t kOtherCapacity>
145 deque_ = other.deque_;
151 deque_ = std::move(other.deque_);
158 template <
size_t kOtherCapacity>
161 deque_ = std::move(other.deque_);
165 template <
typename T,
typename = containers::
internal::EnableIfIterable<T>>
174 static constexpr size_type max_size() {
return capacity(); }
175 static constexpr size_type capacity() {
return kCapacity; }
178 template <
typename OtherValueType,
typename OtherSizeType,
size_t kOtherSized>
179 friend class BasicInlineQueue;
181 template <
typename,
typename>
182 friend class containers::internal::BasicInlineQueueImpl;
188 BasicInlineDeque<ValueType, SizeType>& deque() {
return deque_; }
189 const BasicInlineDeque<ValueType, SizeType>& deque()
const {
return deque_; }
191 BasicInlineDeque<ValueType, SizeType, kCapacity> deque_;
199template <
typename ValueType,
typename SizeType>
202 BasicInlineQueue<ValueType,
204 containers::internal::kGenericSized>,
205 BasicInlineDeque<ValueType, SizeType>> {
211 containers::internal::kGenericSized>,
215 using typename Base::const_iterator;
216 using typename Base::const_pointer;
217 using typename Base::const_reference;
218 using typename Base::difference_type;
219 using typename Base::iterator;
220 using typename Base::pointer;
221 using typename Base::reference;
222 using typename Base::size_type;
223 using typename Base::value_type;
233 template <
typename,
typename>
236 template <
size_t kCapacity>
245 const Deque& deque()
const {
246 return static_cast<const Derived<0>*
>(
this)->deque();
252namespace containers::internal {
254template <
typename Derived,
typename Deque>
260 using typename Base::const_iterator;
261 using typename Base::const_pointer;
262 using typename Base::const_reference;
263 using typename Base::difference_type;
264 using typename Base::iterator;
265 using typename Base::pointer;
266 using typename Base::reference;
267 using typename Base::size_type;
268 using typename Base::value_type;
272 reference at(size_type index) {
return deque().at(index); }
273 const_reference at(size_type index)
const {
return deque().at(index); }
275 reference operator[](size_type index) {
return deque()[index]; }
276 const_reference operator[](size_type index)
const {
return deque()[index]; }
280 return deque().contiguous_data();
283 return deque().contiguous_data();
288 iterator begin()
noexcept {
return deque().begin(); }
289 const_iterator begin()
const noexcept {
return cbegin(); }
290 const_iterator cbegin()
const noexcept {
return deque().cbegin(); }
292 iterator end()
noexcept {
return deque().end(); }
293 const_iterator end()
const noexcept {
return cend(); }
294 const_iterator cend()
const noexcept {
return deque().cend(); }
Definition: inline_queue.h:205
Definition: inline_queue.h:59
Definition: inline_deque.h:74
Definition: inline_queue.h:255
Definition: generic_queue.h:25
Definition: span_impl.h:235
BasicInlineQueue & operator=(BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_queue.h:159
BasicInlineQueue & operator=(const BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_queue.h:143
BasicInlineQueue & operator=(BasicInlineQueue &&other)
Move assigns from matching capacity.
Definition: inline_queue.h:150
BasicInlineQueue & operator=(const BasicInlineQueue &other)
Copy assigns from matching capacity.
Definition: inline_queue.h:134
BasicInlineQueue(BasicInlineQueue &&other)
Move constructs for matching capacity.
Definition: inline_queue.h:113
BasicInlineQueue(BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &&other)
Definition: inline_queue.h:120
BasicInlineQueue(const BasicInlineQueue< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_queue.h:107
BasicInlineQueue(const BasicInlineQueue &other)
Copy constructs for matching capacity.
Definition: inline_queue.h:101
The Pigweed namespace.
Definition: alignment.h:27
Definition: constexpr_tag.h:48