21#if FL_PLATFORM_HAS_LARGE_MEMORY
58 for (fl::size i = 0; i <
capacity; ++i) {
81 if (
mSize == 0)
return 0;
99 fl::size needed = used + extra_front + extra_back;
103 fl::size new_front = extra_front + (new_cap - needed) / 2;
116 if (i < mFrontMapIdx || i >= live_end) {
121 for (fl::size i = 0; i < used; ++i) {
142 if (
mMap[need_chunk_idx] ==
nullptr) {
145 return mMap[need_chunk_idx] !=
nullptr;
178 fl::size before =
mSize;
180 return mSize != before;
213 return &(*mDeque)[
mIndex];
259 return mIndex - other.mIndex;
267 return mDeque == other.mDeque &&
mIndex == other.mIndex;
271 return !(*
this == other);
275 return mIndex < other.mIndex;
279 return mIndex <= other.mIndex;
283 return mIndex > other.mIndex;
287 return mIndex >= other.mIndex;
316 return &(*mDeque)[
mIndex];
362 return mIndex - other.mIndex;
370 return mDeque == other.mDeque &&
mIndex == other.mIndex;
374 return !(*
this == other);
378 return mIndex < other.mIndex;
382 return mIndex <= other.mIndex;
386 return mIndex > other.mIndex;
390 return mIndex >= other.mIndex;
432 if (
this != &other) {
434 for (fl::size i = 0; i < other.size(); ++i) {
442 if (
this != &other) {
457 other.mMap =
nullptr;
458 other.mMapCapacity = 0;
459 other.mFrontMapIdx = 0;
460 other.mFrontOffset = 0;
468 fl::size c, o;
locate(index, c, o);
473 fl::size c, o;
locate(index, c, o);
478 if (index >=
mSize) {
483 fl::size c, o;
locate(index, c, o);
488 if (index >=
mSize) {
491 fl::size c, o;
locate(index, c, o);
536 fl::size allocated = 0;
538 if (
mMap[i] !=
nullptr) ++allocated;
544 return static_cast<fl::size
>(-1) /
sizeof(T);
554 if (cur_chunks < needed_chunks) {
555 fl::size extra = needed_chunks - cur_chunks;
563 for (fl::size i = 0; i < extra; ++i) {
565 if (
mMap[first_new + i] ==
nullptr) {
592 if (i < mFrontMapIdx || i > last_used) {
602 for (fl::size i = 0; i <
mSize; ++i) {
603 fl::size c, o;
locate(i, c, o);
657 if (
mSize == 0)
return;
664 if (
mSize == 0)
return;
679 while (
mSize < new_size) {
686 if (
this != &other) {
691 fl::size t_size =
mSize;
702 other.mMapCapacity = t_cap;
703 other.mFrontMapIdx = t_idx;
704 other.mFrontOffset = t_off;
705 other.mSize = t_size;
706 other.mResource = t_res;
720 fl::size idx =
pos.mIndex;
723 return iterator(
this, idx);
728 fl::size old_size =
mSize;
730 if (
mSize == old_size)
return end();
731 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
732 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
734 (*this)[idx] =
value;
735 return iterator(
this, idx);
739 fl::size idx =
pos.mIndex;
742 return iterator(
this, idx);
747 fl::size old_size =
mSize;
749 if (
mSize == old_size)
return end();
750 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
751 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
754 return iterator(
this, idx);
758 fl::size idx =
pos.mIndex;
759 if (count == 0)
return iterator(
this, idx);
760 fl::size old_size =
mSize;
765 for (fl::size k = 0; k < count; ++k) {
766 fl::size before =
mSize;
769 if (
mSize == before) {
776 for (fl::size i = old_size; i > idx; --i) {
777 (*this)[i - 1 + count] =
fl::move((*
this)[i - 1]);
779 for (fl::size i = 0; i < count; ++i) {
780 (*this)[idx + i] =
value;
782 return iterator(
this, idx);
787 fl::size idx =
pos.mIndex;
788 for (fl::size i = idx; i + 1 <
mSize; ++i) {
789 (*this)[i] =
fl::move((*
this)[i + 1]);
792 return iterator(
this, idx);
796 fl::size start_idx = first.mIndex;
797 if (first == last)
return iterator(
this, start_idx);
798 fl::size count = last.mIndex - first.mIndex;
799 for (fl::size i = start_idx; i + count <
mSize; ++i) {
800 (*this)[i] =
fl::move((*
this)[i + count]);
802 for (fl::size k = 0; k < count; ++k) {
805 return iterator(
this, start_idx);
808 template<
typename... Args>
810 fl::size idx =
pos.mIndex;
813 return iterator(
this, idx);
818 fl::size old_size =
mSize;
820 if (
mSize == old_size)
return end();
821 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
822 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
825 return iterator(
this, idx);
830 template<
typename... Args>
840 template<
typename... Args>
855 for (fl::size i = 0; i < count; ++i) {
861 if (
mSize != other.mSize)
return false;
862 for (fl::size i = 0; i <
mSize; ++i) {
863 if ((*
this)[i] != other[i])
return false;
871 fl::size min_size =
mSize < other.mSize ?
mSize : other.mSize;
872 for (fl::size i = 0; i < min_size; ++i) {
873 if ((*
this)[i] < other[i])
return true;
874 if ((*
this)[i] > other[i])
return false;
876 return mSize < other.mSize;
const_iterator & operator-=(fl::size n) FL_NO_EXCEPT
const_iterator & operator++() FL_NO_EXCEPT
bool operator!=(const const_iterator &other) const FL_NO_EXCEPT
const_iterator & operator--() FL_NO_EXCEPT
const_iterator operator+(fl::size n) const FL_NO_EXCEPT
const T & operator[](fl::size n) const FL_NO_EXCEPT
const_iterator & operator+=(fl::size n) FL_NO_EXCEPT
bool operator>(const const_iterator &other) const FL_NO_EXCEPT
bool operator==(const const_iterator &other) const FL_NO_EXCEPT
bool operator>=(const const_iterator &other) const FL_NO_EXCEPT
fl::size operator-(const const_iterator &other) const FL_NO_EXCEPT
const_iterator operator--(int) FL_NO_EXCEPT
const T * operator->() const FL_NO_EXCEPT
bool operator<=(const const_iterator &other) const FL_NO_EXCEPT
const T & operator*() const FL_NO_EXCEPT
const_iterator(const iterator &it) FL_NO_EXCEPT
const_iterator(const deque *dq, fl::size index) FL_NO_EXCEPT
const_iterator operator++(int) FL_NO_EXCEPT
const_iterator operator-(fl::size n) const FL_NO_EXCEPT
bool operator<(const const_iterator &other) const FL_NO_EXCEPT
fl::random_access_iterator_tag iterator_category
bool operator<=(const iterator &other) const FL_NO_EXCEPT
iterator operator-(fl::size n) const FL_NO_EXCEPT
bool operator>(const iterator &other) const FL_NO_EXCEPT
iterator & operator+=(fl::size n) FL_NO_EXCEPT
fl::random_access_iterator_tag iterator_category
T & operator*() const FL_NO_EXCEPT
iterator operator--(int) FL_NO_EXCEPT
bool operator==(const iterator &other) const FL_NO_EXCEPT
fl::size operator-(const iterator &other) const FL_NO_EXCEPT
iterator(deque *dq, fl::size index) FL_NO_EXCEPT
bool operator!=(const iterator &other) const FL_NO_EXCEPT
iterator operator++(int) FL_NO_EXCEPT
iterator & operator++() FL_NO_EXCEPT
iterator operator+(fl::size n) const FL_NO_EXCEPT
bool operator>=(const iterator &other) const FL_NO_EXCEPT
bool operator<(const iterator &other) const FL_NO_EXCEPT
T * operator->() const FL_NO_EXCEPT
T & operator[](fl::size n) const FL_NO_EXCEPT
iterator & operator--() FL_NO_EXCEPT
iterator & operator-=(fl::size n) FL_NO_EXCEPT
bool operator>=(const deque &other) const FL_NO_EXCEPT
bool try_push_back(const T &value) FL_NO_EXCEPT
iterator erase(const_iterator pos) FL_NO_EXCEPT
memory_resource * mResource
iterator begin() FL_NO_EXCEPT
const T & back() const FL_NO_EXCEPT
iterator erase(const_iterator first, const_iterator last) FL_NO_EXCEPT
void clear() FL_NO_EXCEPT
fl::size capacity() const FL_NO_EXCEPT
const_reverse_iterator crend() const FL_NO_EXCEPT
void push_front(T &&value) FL_NO_EXCEPT
void swap(deque &other) FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
void deallocate_chunk(T *chunk) FL_NO_EXCEPT
void push_back(const T &value) FL_NO_EXCEPT
void locate(fl::size logical_idx, fl::size &chunk_idx, fl::size &offset) const FL_NO_EXCEPT
void resize(fl::size new_size, const T &value) FL_NO_EXCEPT
fl::reverse_iterator< const_iterator > const_reverse_iterator
fl::reverse_iterator< iterator > reverse_iterator
void pop_back() FL_NO_EXCEPT
iterator insert(const_iterator pos, fl::size count, const T &value) FL_NO_EXCEPT
void shrink_to_fit() FL_NO_EXCEPT
deque & operator=(deque &&other) FL_NO_EXCEPT
deque(fl::size count, const T &value=T()) FL_NO_EXCEPT
bool ensure_front_room() FL_NO_EXCEPT
iterator emplace(const_iterator pos, Args &&... args) FL_NO_EXCEPT
fl::size max_size() const FL_NO_EXCEPT
bool operator>(const deque &other) const FL_NO_EXCEPT
const_iterator end() const FL_NO_EXCEPT
void push_front(const T &value) FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
static constexpr fl::size kChunkSize
fl::size size() const FL_NO_EXCEPT
void deallocate_map(T **map, fl::size capacity) FL_NO_EXCEPT
void push_back(T &&value) FL_NO_EXCEPT
bool operator<=(const deque &other) const FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
bool ensure_back_room() FL_NO_EXCEPT
void emplace_front(Args &&... args) FL_NO_EXCEPT
T & at(fl::size index) FL_NO_EXCEPT
iterator end() FL_NO_EXCEPT
void reserve(fl::size n) FL_NO_EXCEPT
deque(memory_resource *resource) FL_NO_EXCEPT
T * allocate_chunk() FL_NO_EXCEPT
deque(deque &&other) FL_NO_EXCEPT
void pop_front() FL_NO_EXCEPT
const_iterator begin() const FL_NO_EXCEPT
T ** allocate_map(fl::size capacity) FL_NO_EXCEPT
const_iterator cend() const FL_NO_EXCEPT
T & operator[](fl::size index) FL_NO_EXCEPT
const_reverse_iterator crbegin() const FL_NO_EXCEPT
bool operator<(const deque &other) const FL_NO_EXCEPT
memory_resource * get_memory_resource() const FL_NO_EXCEPT
iterator insert(const_iterator pos, T &&value) FL_NO_EXCEPT
fl::size used_chunks() const FL_NO_EXCEPT
void emplace_back(Args &&... args) FL_NO_EXCEPT
const_iterator cbegin() const FL_NO_EXCEPT
const T & at(fl::size index) const FL_NO_EXCEPT
bool empty() const FL_NO_EXCEPT
void grow_map(fl::size extra_front, fl::size extra_back) FL_NO_EXCEPT
deque(const deque &other) FL_NO_EXCEPT
const T & operator[](fl::size index) const FL_NO_EXCEPT
bool operator!=(const deque &other) const FL_NO_EXCEPT
iterator insert(const_iterator pos, const T &value) FL_NO_EXCEPT
void assign(fl::size count, const T &value) FL_NO_EXCEPT
bool operator==(const deque &other) const FL_NO_EXCEPT
deque & operator=(const deque &other) FL_NO_EXCEPT
deque(fl::initializer_list< T > init) FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
void resize(fl::size new_size) FL_NO_EXCEPT
const T & front() const FL_NO_EXCEPT
Polymorphic memory resource base class (PMR-style).
Reverse iterator adapter - reverses the direction of a bidirectional iterator.
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
PMR-style polymorphic memory resource for type-erased allocation.
FL_NO_INLINE fl::size deque_grow_map_capacity(fl::size current_map_capacity, fl::size min_required_chunks) FL_NO_EXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
constexpr T && forward(typename remove_reference< T >::type &t) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
constexpr int type_rank< T >::value
MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > > map
void init(Context &ctx, int w, int h) FL_NO_EXCEPT
deque< float > deque_float
memory_resource * default_memory_resource() FL_NO_EXCEPT
Get the default memory resource (wraps fl::Malloc / fl::Free / fl::realloc).
deque< double > deque_double
Base definition for an LED controller.
static constexpr fl::size chunk_size