18#include <initializer_list>
23#include "pw_assert/assert.h"
24#include "pw_containers/internal/generic_deque.h"
25#include "pw_containers/internal/raw_storage.h"
26#include "pw_toolchain/constexpr_tag.h"
29namespace containers::internal {
32template <
typename T,
typename SizeType,
size_t kCapacity>
33class BasicInlineDequeImpl;
39template <
typename ValueType,
41 size_t kCapacity = containers::internal::kGenericSized>
42using BasicInlineDeque =
43 containers::internal::BasicInlineDequeImpl<ValueType, SizeType, kCapacity>;
62template <
typename T,
size_t kCapacity = containers::
internal::kGenericSized>
67namespace containers::internal {
69template <
typename ValueType,
typename SizeType,
size_t kCapacity>
72 BasicInlineDequeImpl<ValueType, SizeType, kGenericSized>,
79 using typename Base::const_iterator;
80 using typename Base::const_pointer;
81 using typename Base::const_reference;
82 using typename Base::difference_type;
83 using typename Base::iterator;
84 using typename Base::pointer;
85 using typename Base::reference;
86 using typename Base::size_type;
87 using typename Base::value_type;
107 template <
typename InputIterator,
108 typename = EnableIfInputIterator<InputIterator>>
119 template <
size_t kOtherCapacity>
127 *
this = std::move(other);
131 template <
size_t kOtherCapacity>
135 *
this = std::move(other);
144 template <
typename T,
typename = EnableIfIterable<T>>
161 const std::initializer_list<value_type>& list) {
162 Base::operator=(list);
168 Base::operator=(
static_cast<const Base&
>(other));
175 template <
size_t kOtherCapacity>
178 Base::operator=(
static_cast<const Base&
>(other));
184 Base::operator=(
static_cast<Base&&
>(std::move(other)));
189 template <
size_t kOtherCapacity>
193 Base::operator=(
static_cast<Base&&
>(std::move(other)));
197 template <
typename T,
typename = EnableIfIterable<T>>
199 Base::operator=(other);
205 static constexpr size_type max_size() {
return capacity(); }
206 static constexpr size_type capacity() {
return kCapacity; }
217template <
typename ValueType,
typename SizeType>
220 BasicInlineDequeImpl<ValueType, SizeType, kGenericSized>,
230 using typename Base::const_iterator;
231 using typename Base::const_pointer;
232 using typename Base::const_reference;
233 using typename Base::difference_type;
234 using typename Base::iterator;
235 using typename Base::pointer;
236 using typename Base::reference;
237 using typename Base::size_type;
238 using typename Base::value_type;
250 for (
auto&& item : other) {
251 Base::emplace_back(std::move(item));
257 using Base::operator=;
269 template <
size_t kCapacity>
271 RawStorage<BasicInlineDequeImpl<ValueType, SizeType, kGenericSized>,
279 pointer data() {
return static_cast<Derived<0>*
>(
this)->data(); }
280 const_pointer data()
const {
281 return static_cast<const Derived<0>*
>(
this)->data();
287 static constexpr bool kFixedCapacity =
true;
Definition: inline_deque.h:222
Definition: inline_deque.h:74
BasicInlineDequeImpl(const BasicInlineDequeImpl &other)
Copy constructs for matching capacity.
Definition: inline_deque.h:114
BasicInlineDequeImpl(size_type count)
Constructs with count default-initialized elements.
Definition: inline_deque.h:103
BasicInlineDequeImpl & operator=(BasicInlineDequeImpl< ValueType, SizeType, kOtherCapacity > &&other) noexcept
Move assigns for mismatched capacity.
Definition: inline_deque.h:190
BasicInlineDequeImpl() noexcept=default
Constructs with zero elements.
BasicInlineDequeImpl & operator=(const std::initializer_list< value_type > &list)
Copy assigns from list.
Definition: inline_deque.h:160
BasicInlineDequeImpl(size_type count, const_reference value)
Constructs with count copies of value.
Definition: inline_deque.h:98
BasicInlineDequeImpl(const T &other)
Copy constructor for arbitrary iterables.
Definition: inline_deque.h:145
BasicInlineDequeImpl(const BasicInlineDequeImpl< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_deque.h:120
BasicInlineDequeImpl(BasicInlineDequeImpl &&other) noexcept
Move constructs for matching capacity.
Definition: inline_deque.h:126
BasicInlineDequeImpl & operator=(const BasicInlineDequeImpl &other)
Copy assigns for matching capacity.
Definition: inline_deque.h:167
BasicInlineDequeImpl(InputIterator start, InputIterator finish)
Copy constructs from an iterator.
Definition: inline_deque.h:109
BasicInlineDequeImpl & operator=(BasicInlineDequeImpl &&other) noexcept
Move assigns for matching capacity.
Definition: inline_deque.h:183
BasicInlineDequeImpl(const std::initializer_list< value_type > &list)
Copy constructs from an initializer list.
Definition: inline_deque.h:139
BasicInlineDequeImpl(BasicInlineDequeImpl< ValueType, SizeType, kOtherCapacity > &&other) noexcept
Move constructs for mismatched capacity.
Definition: inline_deque.h:132
BasicInlineDequeImpl & operator=(const BasicInlineDequeImpl< ValueType, SizeType, kOtherCapacity > &other)
Definition: inline_deque.h:176
Definition: generic_deque.h:178
void assign(size_type count, const value_type &value)
Sets the contents to count copies of value. Crashes if cannot fit.
Definition: generic_deque.h:209
constexpr size_type capacity() const noexcept
Returns the maximum number of elements in the deque.
Definition: generic_deque.h:72
The Pigweed namespace.
Definition: alignment.h:27
Definition: constexpr_tag.h:48