FastLED 3.9.15
Loading...
Searching...
No Matches
deque.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/stdint.h"
4
5#include "fl/stl/move.h"
6#include "fl/stl/iterator.h"
8#include "fl/stl/new.h" // IWYU pragma: keep
9#include "fl/stl/noexcept.h"
10
11namespace fl {
12
13template <typename T>
14class deque {
15private:
16 T* mData = nullptr;
17 fl::size mCapacity = 0;
18 fl::size mSize = 0;
19 fl::size mFront = 0; // Index of the front element
21
22 static const fl::size kInitialCapacity = 8;
23
24 void ensure_capacity(fl::size min_capacity) {
25 if (mCapacity >= min_capacity) {
26 return;
27 }
28
29 fl::size new_capacity = mCapacity == 0 ? kInitialCapacity : mCapacity * 2;
30 while (new_capacity < min_capacity) {
31 new_capacity *= 2;
32 }
33
34 T* new_data = static_cast<T*>(mResource->allocate(new_capacity * sizeof(T)));
35 if (!new_data) {
36 return; // Allocation failed
37 }
38
39 // Copy existing elements to new buffer in linear order
40 for (fl::size i = 0; i < mSize; ++i) {
41 fl::size old_idx = (mFront + i) % mCapacity;
42 new (&new_data[i]) T(fl::move(mData[old_idx]));
43 mData[old_idx].~T();
44 }
45
46 if (mData) {
47 mResource->deallocate(mData, mCapacity * sizeof(T));
48 }
49
50 mData = new_data;
51 mCapacity = new_capacity;
52 mFront = 0; // Reset front to 0 after reallocation
53 }
54
55 fl::size get_index(fl::size logical_index) const {
56 return (mFront + logical_index) % mCapacity;
57 }
58
59public:
60 // Iterator implementation (RandomAccessIterator)
61 class iterator {
62 public:
63 typedef T value_type;
64 typedef T& reference;
65 typedef T* pointer;
66 typedef fl::size difference_type;
68
69 private:
71 fl::size mIndex;
72
73 friend class deque;
74
75 public:
76 iterator(deque* dq, fl::size index) : mDeque(dq), mIndex(index) {}
77
78 T& operator*() const {
79 return (*mDeque)[mIndex];
80 }
81
82 T* operator->() const {
83 return &(*mDeque)[mIndex];
84 }
85
87 ++mIndex;
88 return *this;
89 }
90
92 iterator temp = *this;
93 ++mIndex;
94 return temp;
95 }
96
98 --mIndex;
99 return *this;
100 }
101
103 iterator temp = *this;
104 --mIndex;
105 return temp;
106 }
107
108 iterator& operator+=(fl::size n) {
109 mIndex += n;
110 return *this;
111 }
112
113 iterator operator+(fl::size n) const {
114 iterator temp = *this;
115 return temp += n;
116 }
117
118 iterator& operator-=(fl::size n) {
119 mIndex -= n;
120 return *this;
121 }
122
123 iterator operator-(fl::size n) const {
124 iterator temp = *this;
125 return temp -= n;
126 }
127
128 fl::size operator-(const iterator& other) const {
129 return mIndex - other.mIndex;
130 }
131
132 T& operator[](fl::size n) const {
133 return (*mDeque)[mIndex + n];
134 }
135
136 bool operator==(const iterator& other) const {
137 return mDeque == other.mDeque && mIndex == other.mIndex;
138 }
139
140 bool operator!=(const iterator& other) const {
141 return !(*this == other);
142 }
143
144 bool operator<(const iterator& other) const {
145 return mIndex < other.mIndex;
146 }
147
148 bool operator<=(const iterator& other) const {
149 return mIndex <= other.mIndex;
150 }
151
152 bool operator>(const iterator& other) const {
153 return mIndex > other.mIndex;
154 }
155
156 bool operator>=(const iterator& other) const {
157 return mIndex >= other.mIndex;
158 }
159 };
160
162 public:
163 typedef T value_type;
164 typedef const T& reference;
165 typedef const T* pointer;
166 typedef fl::size difference_type;
168
169 private:
170 const deque* mDeque;
171 fl::size mIndex;
172
173 friend class deque;
174
175 public:
176 const_iterator(const deque* dq, fl::size index) : mDeque(dq), mIndex(index) {}
177
178 // Implicit conversion from iterator to const_iterator
180
181 const T& operator*() const {
182 return (*mDeque)[mIndex];
183 }
184
185 const T* operator->() const {
186 return &(*mDeque)[mIndex];
187 }
188
190 ++mIndex;
191 return *this;
192 }
193
195 const_iterator temp = *this;
196 ++mIndex;
197 return temp;
198 }
199
201 --mIndex;
202 return *this;
203 }
204
206 const_iterator temp = *this;
207 --mIndex;
208 return temp;
209 }
210
212 mIndex += n;
213 return *this;
214 }
215
216 const_iterator operator+(fl::size n) const {
217 const_iterator temp = *this;
218 return temp += n;
219 }
220
222 mIndex -= n;
223 return *this;
224 }
225
226 const_iterator operator-(fl::size n) const {
227 const_iterator temp = *this;
228 return temp -= n;
229 }
230
231 fl::size operator-(const const_iterator& other) const {
232 return mIndex - other.mIndex;
233 }
234
235 const T& operator[](fl::size n) const {
236 return (*mDeque)[mIndex + n];
237 }
238
239 bool operator==(const const_iterator& other) const {
240 return mDeque == other.mDeque && mIndex == other.mIndex;
241 }
242
243 bool operator!=(const const_iterator& other) const {
244 return !(*this == other);
245 }
246
247 bool operator<(const const_iterator& other) const {
248 return mIndex < other.mIndex;
249 }
250
251 bool operator<=(const const_iterator& other) const {
252 return mIndex <= other.mIndex;
253 }
254
255 bool operator>(const const_iterator& other) const {
256 return mIndex > other.mIndex;
257 }
258
259 bool operator>=(const const_iterator& other) const {
260 return mIndex >= other.mIndex;
261 }
262 };
263
266
267 // Constructors
268 deque() FL_NOEXCEPT : mData(nullptr), mCapacity(0), mSize(0), mFront(0) {}
269
270 explicit deque(memory_resource* resource) : mData(nullptr), mCapacity(0), mSize(0), mFront(0), mResource(resource) {}
271
272 explicit deque(fl::size count, const T& value = T()) : deque() {
273 resize(count, value);
274 }
275
276 deque(const deque& other) FL_NOEXCEPT : deque() {
277 *this = other;
278 }
279
281 *this = fl::move(other);
282 }
283
284 deque(fl::initializer_list<T> init) : deque() {
285 for (const auto& value : init) {
287 }
288 }
289
290 // Destructor
292 clear();
293 if (mData) {
294 mResource->deallocate(mData, mCapacity * sizeof(T));
295 }
296 }
297
298 // Assignment operators
300 if (this != &other) {
301 clear();
302 for (fl::size i = 0; i < other.size(); ++i) {
303 push_back(other[i]);
304 }
305 }
306 return *this;
307 }
308
310 if (this != &other) {
311 clear();
312 if (mData) {
313 mResource->deallocate(mData, mCapacity * sizeof(T));
314 }
315
316 mData = other.mData;
317 mCapacity = other.mCapacity;
318 mSize = other.mSize;
319 mFront = other.mFront;
320 mResource = other.mResource;
321
322 other.mData = nullptr;
323 other.mCapacity = 0;
324 other.mSize = 0;
325 other.mFront = 0;
326 }
327 return *this;
328 }
329
330 // Element access
331 T& operator[](fl::size index) {
332 return mData[get_index(index)];
333 }
334
335 const T& operator[](fl::size index) const {
336 return mData[get_index(index)];
337 }
338
339 T& at(fl::size index) {
340 if (index >= mSize) {
341 // Handle bounds error - in embedded context, we'll just return the first element
342 // In a real implementation, this might throw an exception
343 return mData[mFront];
344 }
345 return mData[get_index(index)];
346 }
347
348 const T& at(fl::size index) const {
349 if (index >= mSize) {
350 // Handle bounds error - in embedded context, we'll just return the first element
351 return mData[mFront];
352 }
353 return mData[get_index(index)];
354 }
355
356 T& front() {
357 return mData[mFront];
358 }
359
360 const T& front() const {
361 return mData[mFront];
362 }
363
364 T& back() {
365 return mData[get_index(mSize - 1)];
366 }
367
368 const T& back() const {
369 return mData[get_index(mSize - 1)];
370 }
371
372 // Iterators
373 iterator begin() {
374 return iterator(this, 0);
375 }
376
377 const_iterator begin() const {
378 return const_iterator(this, 0);
379 }
380
381 iterator end() {
382 return iterator(this, mSize);
383 }
384
385 const_iterator end() const {
386 return const_iterator(this, mSize);
387 }
388
389 // Reverse iterators
391 return reverse_iterator(end());
392 }
393
397
399 return reverse_iterator(begin());
400 }
401
405
406 // Explicit const iterator accessors
407 const_iterator cbegin() const {
408 return const_iterator(this, 0);
409 }
410
411 const_iterator cend() const {
412 return const_iterator(this, mSize);
413 }
414
418
422
423 // Capacity
424 bool empty() const {
425 return mSize == 0;
426 }
427
428 fl::size size() const {
429 return mSize;
430 }
431
432 fl::size capacity() const {
433 return mCapacity;
434 }
435
436 fl::size max_size() const {
437 // Return a reasonable max size (limited by size_t or memory)
438 return static_cast<fl::size>(-1) / sizeof(T);
439 }
440
441 void reserve(fl::size new_capacity) {
442 if (new_capacity > mCapacity) {
443 ensure_capacity(new_capacity);
444 }
445 }
446
448 if (mSize < mCapacity) {
449 if (mSize == 0) {
450 if (mData) {
451 mResource->deallocate(mData, mCapacity * sizeof(T));
452 }
453 mData = nullptr;
454 mCapacity = 0;
455 mFront = 0;
456 } else {
457 // Reallocate to exact size
458 T* new_data = static_cast<T*>(mResource->allocate(mSize * sizeof(T)));
459 if (!new_data) {
460 return; // Allocation failed
461 }
462
463 // Copy elements to new buffer
464 for (fl::size i = 0; i < mSize; ++i) {
465 fl::size old_idx = (mFront + i) % mCapacity;
466 new (&new_data[i]) T(fl::move(mData[old_idx]));
467 mData[old_idx].~T();
468 }
469
470 if (mData) {
471 mResource->deallocate(mData, mCapacity * sizeof(T));
472 }
473
474 mData = new_data;
476 mFront = 0;
477 }
478 }
479 }
480
482 return mResource;
483 }
484
485 // Modifiers
486 void clear() {
487 while (!empty()) {
488 pop_back();
489 }
490 }
491
492 void push_back(const T& value) {
494 fl::size back_index = get_index(mSize);
495 new (&mData[back_index]) T(value);
496 ++mSize;
497 }
498
499 void push_back(T&& value) {
501 fl::size back_index = get_index(mSize);
502 new (&mData[back_index]) T(fl::move(value));
503 ++mSize;
504 }
505
506 void push_front(const T& value) {
508 mFront = (mFront - 1 + mCapacity) % mCapacity;
509 new (&mData[mFront]) T(value);
510 ++mSize;
511 }
512
513 void push_front(T&& value) {
515 mFront = (mFront - 1 + mCapacity) % mCapacity;
516 new (&mData[mFront]) T(fl::move(value));
517 ++mSize;
518 }
519
520 void pop_back() {
521 if (mSize > 0) {
522 fl::size back_index = get_index(mSize - 1);
523 mData[back_index].~T();
524 --mSize;
525 }
526 }
527
528 void pop_front() {
529 if (mSize > 0) {
530 mData[mFront].~T();
531 mFront = (mFront + 1) % mCapacity;
532 --mSize;
533 }
534 }
535
536 void resize(fl::size new_size) {
537 resize(new_size, T());
538 }
539
540 void resize(fl::size new_size, const T& value) {
541 if (new_size > mSize) {
542 // Add elements
543 ensure_capacity(new_size);
544 while (mSize < new_size) {
546 }
547 } else if (new_size < mSize) {
548 // Remove elements
549 while (mSize > new_size) {
550 pop_back();
551 }
552 }
553 // If new_size == mSize, do nothing
554 }
555
556 void swap(deque& other) {
557 if (this != &other) {
558 T* temp_data = mData;
559 fl::size temp_capacity = mCapacity;
560 fl::size temp_size = mSize;
561 fl::size temp_front = mFront;
562 memory_resource* temp_resource = mResource;
563
564 mData = other.mData;
565 mCapacity = other.mCapacity;
566 mSize = other.mSize;
567 mFront = other.mFront;
568 mResource = other.mResource;
569
570 other.mData = temp_data;
571 other.mCapacity = temp_capacity;
572 other.mSize = temp_size;
573 other.mFront = temp_front;
574 other.mResource = temp_resource;
575 }
576 }
577
578 // Insert operations
579 iterator insert(const_iterator pos, const T& value) {
580 fl::size index = pos.mIndex;
582
583 // Shift elements from pos to end one position to the right
584 for (fl::size i = mSize; i > index; --i) {
585 fl::size from_idx = get_index(i - 1);
586 fl::size to_idx = get_index(i);
587 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
588 mData[from_idx].~T();
589 }
590
591 // Insert new element
592 fl::size insert_idx = get_index(index);
593 new (&mData[insert_idx]) T(value);
594 ++mSize;
595
596 return iterator(this, index);
597 }
598
599 iterator insert(const_iterator pos, T&& value) {
600 fl::size index = pos.mIndex;
602
603 // Shift elements from pos to end one position to the right
604 for (fl::size i = mSize; i > index; --i) {
605 fl::size from_idx = get_index(i - 1);
606 fl::size to_idx = get_index(i);
607 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
608 mData[from_idx].~T();
609 }
610
611 // Insert new element
612 fl::size insert_idx = get_index(index);
613 new (&mData[insert_idx]) T(fl::move(value));
614 ++mSize;
615
616 return iterator(this, index);
617 }
618
619 iterator insert(const_iterator pos, fl::size count, const T& value) {
620 fl::size index = pos.mIndex;
621 ensure_capacity(mSize + count);
622
623 // Shift elements from pos to end 'count' positions to the right
624 for (fl::size i = mSize + count - 1; i >= index + count; --i) {
625 fl::size from_idx = get_index(i - count);
626 fl::size to_idx = get_index(i);
627 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
628 mData[from_idx].~T();
629 }
630
631 // Insert new elements
632 for (fl::size i = 0; i < count; ++i) {
633 fl::size insert_idx = get_index(index + i);
634 new (&mData[insert_idx]) T(value);
635 }
636 mSize += count;
637
638 return iterator(this, index);
639 }
640
641 // Erase operations
642 iterator erase(const_iterator pos) {
643 if (pos == end()) return end();
644
645 fl::size index = pos.mIndex;
646
647 // Destroy element at pos
648 fl::size erase_idx = get_index(index);
649 mData[erase_idx].~T();
650
651 // Shift elements from pos+1 to end one position to the left
652 for (fl::size i = index; i < mSize - 1; ++i) {
653 fl::size from_idx = get_index(i + 1);
654 fl::size to_idx = get_index(i);
655 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
656 mData[from_idx].~T();
657 }
658
659 --mSize;
660 return iterator(this, index);
661 }
662
663 iterator erase(const_iterator first, const_iterator last) {
664 if (first == last) return iterator(this, first.mIndex);
665
666 fl::size start_idx = first.mIndex;
667 fl::size count = last.mIndex - first.mIndex;
668
669 // Destroy elements in range
670 for (fl::size i = 0; i < count; ++i) {
671 fl::size destroy_idx = get_index(start_idx + i);
672 mData[destroy_idx].~T();
673 }
674
675 // Shift remaining elements left
676 for (fl::size i = start_idx; i < mSize - count; ++i) {
677 fl::size from_idx = get_index(i + count);
678 fl::size to_idx = get_index(i);
679 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
680 mData[from_idx].~T();
681 }
682
683 mSize -= count;
684 return iterator(this, start_idx);
685 }
686
687 // Emplace operations
688 template<typename... Args>
689 iterator emplace(const_iterator pos, Args&&... args) {
690 fl::size index = pos.mIndex;
692
693 // Shift elements from pos to end one position to the right
694 for (fl::size i = mSize; i > index; --i) {
695 fl::size from_idx = get_index(i - 1);
696 fl::size to_idx = get_index(i);
697 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
698 mData[from_idx].~T();
699 }
700
701 // Construct new element in place
702 fl::size emplace_idx = get_index(index);
703 new (&mData[emplace_idx]) T(fl::forward<Args>(args)...);
704 ++mSize;
705
706 return iterator(this, index);
707 }
708
709 template<typename... Args>
710 T& emplace_back(Args&&... args) {
712 fl::size back_index = get_index(mSize);
713 new (&mData[back_index]) T(fl::forward<Args>(args)...);
714 ++mSize;
715 return mData[back_index];
716 }
717
718 template<typename... Args>
719 T& emplace_front(Args&&... args) {
721 mFront = (mFront - 1 + mCapacity) % mCapacity;
722 new (&mData[mFront]) T(fl::forward<Args>(args)...);
723 ++mSize;
724 return mData[mFront];
725 }
726
727 // Assign operations
728 void assign(fl::size count, const T& value) {
729 clear();
730 ensure_capacity(count);
731 for (fl::size i = 0; i < count; ++i) {
733 }
734 }
735
736 // Comparison operators
737 bool operator==(const deque& other) const {
738 if (mSize != other.mSize) {
739 return false;
740 }
741 for (fl::size i = 0; i < mSize; ++i) {
742 if ((*this)[i] != other[i]) {
743 return false;
744 }
745 }
746 return true;
747 }
748
749 bool operator!=(const deque& other) const {
750 return !(*this == other);
751 }
752
753 bool operator<(const deque& other) const {
754 fl::size min_size = mSize < other.mSize ? mSize : other.mSize;
755 for (fl::size i = 0; i < min_size; ++i) {
756 if ((*this)[i] < other[i]) {
757 return true;
758 }
759 if ((*this)[i] > other[i]) {
760 return false;
761 }
762 }
763 return mSize < other.mSize;
764 }
765
766 bool operator<=(const deque& other) const {
767 return *this < other || *this == other;
768 }
769
770 bool operator>(const deque& other) const {
771 return other < *this;
772 }
773
774 bool operator>=(const deque& other) const {
775 return *this > other || *this == other;
776 }
777};
778
779// Convenience typedef for the most common use case
783
784} // namespace fl
uint8_t pos
Definition Blur.ino:11
const_iterator(const iterator &it)
Definition deque.h:179
const T & operator*() const
Definition deque.h:181
fl::size operator-(const const_iterator &other) const
Definition deque.h:231
const_iterator operator+(fl::size n) const
Definition deque.h:216
bool operator!=(const const_iterator &other) const
Definition deque.h:243
const_iterator & operator+=(fl::size n)
Definition deque.h:211
bool operator>(const const_iterator &other) const
Definition deque.h:255
const_iterator & operator--()
Definition deque.h:200
const T * operator->() const
Definition deque.h:185
bool operator<(const const_iterator &other) const
Definition deque.h:247
bool operator==(const const_iterator &other) const
Definition deque.h:239
const_iterator operator--(int)
Definition deque.h:205
const_iterator(const deque *dq, fl::size index)
Definition deque.h:176
bool operator<=(const const_iterator &other) const
Definition deque.h:251
const_iterator operator++(int)
Definition deque.h:194
const T & operator[](fl::size n) const
Definition deque.h:235
bool operator>=(const const_iterator &other) const
Definition deque.h:259
const_iterator & operator++()
Definition deque.h:189
const_iterator & operator-=(fl::size n)
Definition deque.h:221
friend class deque
Definition deque.h:173
const deque * mDeque
Definition deque.h:170
fl::random_access_iterator_tag iterator_category
Definition deque.h:167
const_iterator operator-(fl::size n) const
Definition deque.h:226
deque * mDeque
Definition deque.h:70
iterator(deque *dq, fl::size index)
Definition deque.h:76
bool operator>=(const iterator &other) const
Definition deque.h:156
fl::size mIndex
Definition deque.h:71
bool operator!=(const iterator &other) const
Definition deque.h:140
iterator & operator-=(fl::size n)
Definition deque.h:118
T & operator[](fl::size n) const
Definition deque.h:132
fl::random_access_iterator_tag iterator_category
Definition deque.h:67
T * operator->() const
Definition deque.h:82
bool operator<(const iterator &other) const
Definition deque.h:144
bool operator==(const iterator &other) const
Definition deque.h:136
bool operator>(const iterator &other) const
Definition deque.h:152
iterator & operator++()
Definition deque.h:86
iterator operator--(int)
Definition deque.h:102
T & operator*() const
Definition deque.h:78
iterator & operator+=(fl::size n)
Definition deque.h:108
iterator & operator--()
Definition deque.h:97
fl::size operator-(const iterator &other) const
Definition deque.h:128
fl::size difference_type
Definition deque.h:66
friend class deque
Definition deque.h:73
iterator operator-(fl::size n) const
Definition deque.h:123
iterator operator++(int)
Definition deque.h:91
iterator operator+(fl::size n) const
Definition deque.h:113
bool operator<=(const iterator &other) const
Definition deque.h:148
deque(fl::size count, const T &value=T())
Definition deque.h:272
fl::size size() const
Definition deque.h:428
fl::size mFront
Definition deque.h:19
memory_resource * mResource
Definition deque.h:20
const_iterator begin() const
Definition deque.h:377
T & operator[](fl::size index)
Definition deque.h:331
void push_back(T &&value)
Definition deque.h:499
const_reverse_iterator crend() const
Definition deque.h:419
bool operator<=(const deque &other) const
Definition deque.h:766
void clear()
Definition deque.h:486
deque() FL_NOEXCEPT
Definition deque.h:268
void pop_front()
Definition deque.h:528
bool empty() const
Definition deque.h:424
void push_front(const T &value)
Definition deque.h:506
bool operator!=(const deque &other) const
Definition deque.h:749
void push_front(T &&value)
Definition deque.h:513
deque & operator=(const deque &other) FL_NOEXCEPT
Definition deque.h:299
const_reverse_iterator rbegin() const
Definition deque.h:394
fl::reverse_iterator< const_iterator > const_reverse_iterator
Definition deque.h:265
fl::reverse_iterator< iterator > reverse_iterator
Definition deque.h:264
void resize(fl::size new_size, const T &value)
Definition deque.h:540
iterator emplace(const_iterator pos, Args &&... args)
Definition deque.h:689
bool operator<(const deque &other) const
Definition deque.h:753
T & emplace_back(Args &&... args)
Definition deque.h:710
fl::size capacity() const
Definition deque.h:432
const T & back() const
Definition deque.h:368
fl::size mCapacity
Definition deque.h:17
const T & front() const
Definition deque.h:360
deque(deque &&other) FL_NOEXCEPT
Definition deque.h:280
void shrink_to_fit()
Definition deque.h:447
const_iterator cbegin() const
Definition deque.h:407
memory_resource * get_memory_resource() const
Definition deque.h:481
~deque() FL_NOEXCEPT
Definition deque.h:291
bool operator==(const deque &other) const
Definition deque.h:737
deque & operator=(deque &&other) FL_NOEXCEPT
Definition deque.h:309
void reserve(fl::size new_capacity)
Definition deque.h:441
bool operator>=(const deque &other) const
Definition deque.h:774
void resize(fl::size new_size)
Definition deque.h:536
fl::size mSize
Definition deque.h:18
void ensure_capacity(fl::size min_capacity)
Definition deque.h:24
const_iterator end() const
Definition deque.h:385
const_reverse_iterator crbegin() const
Definition deque.h:415
T & front()
Definition deque.h:356
fl::size get_index(fl::size logical_index) const
Definition deque.h:55
deque(const deque &other) FL_NOEXCEPT
Definition deque.h:276
int * mData
Definition deque.h:16
reverse_iterator rbegin()
Definition deque.h:390
iterator insert(const_iterator pos, T &&value)
Definition deque.h:599
iterator erase(const_iterator first, const_iterator last)
Definition deque.h:663
iterator insert(const_iterator pos, fl::size count, const T &value)
Definition deque.h:619
const T & at(fl::size index) const
Definition deque.h:348
T & at(fl::size index)
Definition deque.h:339
reverse_iterator rend()
Definition deque.h:398
void pop_back()
Definition deque.h:520
fl::size max_size() const
Definition deque.h:436
T & emplace_front(Args &&... args)
Definition deque.h:719
iterator begin()
Definition deque.h:373
const_iterator cend() const
Definition deque.h:411
static const fl::size kInitialCapacity
Definition deque.h:22
iterator insert(const_iterator pos, const T &value)
Definition deque.h:579
T & back()
Definition deque.h:364
void assign(fl::size count, const T &value)
Definition deque.h:728
bool operator>(const deque &other) const
Definition deque.h:770
iterator erase(const_iterator pos)
Definition deque.h:642
const_reverse_iterator rend() const
Definition deque.h:402
void push_back(const T &value)
Definition deque.h:492
const T & operator[](fl::size index) const
Definition deque.h:335
deque(memory_resource *resource)
Definition deque.h:270
deque(fl::initializer_list< T > init)
Definition deque.h:284
iterator end()
Definition deque.h:381
void swap(deque &other)
Definition deque.h:556
Polymorphic memory resource base class (PMR-style).
Reverse iterator adapter - reverses the direction of a bidirectional iterator.
Definition iterator.h:160
PMR-style polymorphic memory resource for type-erased allocation.
constexpr T && forward(typename remove_reference< T >::type &t) FL_NOEXCEPT
Definition s16x16x4.h:234
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
Definition s16x16x4.h:28
constexpr int type_rank< T >::value
void init(Context &ctx, int w, int h)
Definition engine.h:133
memory_resource * default_memory_resource() FL_NOEXCEPT
Get the default memory resource (wraps fl::Malloc / fl::Free / fl::realloc).
deque< float > deque_float
Definition deque.h:781
deque< double > deque_double
Definition deque.h:782
deque< int > deque_int
Definition deque.h:780
Base definition for an LED controller.
Definition crgb.hpp:179
corkscrew_args args
Definition old.h:149
#define FL_NOEXCEPT