16template <
typename T,
typename Allocator = fl::allocator<T>>
33 while (new_capacity < min_capacity) {
37 T* new_data =
mAlloc.allocate(new_capacity);
43 for (fl::size i = 0; i <
mSize; ++i) {
107 return !(*
this == other);
124 return &(*mDeque)[
mIndex];
154 return !(*
this == other);
161 explicit deque(fl::size count,
const T& value = T()) :
deque() {
174 for (
const auto& value : init) {
189 if (
this != &other) {
191 for (fl::size i = 0; i < other.
size(); ++i) {
199 if (
this != &other) {
211 other.mData =
nullptr;
228 T&
at(fl::size index) {
229 if (index >=
mSize) {
237 const T&
at(fl::size index)
const {
238 if (index >=
mSize) {
263 return iterator(
this, 0);
267 return const_iterator(
this, 0);
271 return iterator(
this,
mSize);
274 const_iterator
end()
const {
275 return const_iterator(
this,
mSize);
346 void resize(fl::size new_size,
const T& value) {
347 if (new_size >
mSize) {
350 while (
mSize < new_size) {
353 }
else if (new_size <
mSize) {
355 while (
mSize > new_size) {
363 if (
this != &other) {
364 T* temp_data =
mData;
366 fl::size temp_size =
mSize;
367 fl::size temp_front =
mFront;
368 Allocator temp_alloc =
mAlloc;
376 other.
mData = temp_data;
378 other.
mSize = temp_size;
379 other.
mFront = temp_front;
380 other.
mAlloc = temp_alloc;
bool operator==(const const_iterator &other) const
const_iterator(const deque *dq, fl::size index)
bool operator!=(const const_iterator &other) const
const_iterator & operator--()
const_iterator operator--(int)
const_iterator & operator++()
const T & operator*() const
const T * operator->() const
const_iterator operator++(int)
iterator(deque *dq, fl::size index)
bool operator==(const iterator &other) const
bool operator!=(const iterator &other) const
const_iterator begin() const
void ensure_capacity(fl::size min_capacity)
fl::size capacity() const
const_iterator end() const
void resize(fl::size new_size, const T &value)
deque(const deque &other)
deque & operator=(const deque &other)
const T & operator[](fl::size index) const
void resize(fl::size new_size)
fl::size get_index(fl::size logical_index) const
void push_front(T &&value)
void push_front(const T &value)
void push_back(T &&value)
const T & at(fl::size index) const
fl::allocator< int > mAlloc
static const fl::size kInitialCapacity
deque & operator=(deque &&other)
T & operator[](fl::size index)
deque(fl::size count, const T &value=T())
void push_back(const T &value)
deque(fl::initializer_list< T > init)
Implements the FastLED namespace macros.
constexpr remove_reference< T >::type && move(T &&t) noexcept
deque< float > deque_float
deque< double > deque_double