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) {
141 if (
mMap[need_chunk_idx] ==
nullptr) {
201 return &(*mDeque)[
mIndex];
259 return !(*
this == other);
304 return &(*mDeque)[
mIndex];
362 return !(*
this == other);
420 if (
this != &other) {
422 for (fl::size i = 0; i < other.size(); ++i) {
430 if (
this != &other) {
445 other.mMap =
nullptr;
446 other.mMapCapacity = 0;
447 other.mFrontMapIdx = 0;
448 other.mFrontOffset = 0;
456 fl::size c, o;
locate(index, c, o);
461 fl::size c, o;
locate(index, c, o);
465 T&
at(fl::size index) {
466 if (index >=
mSize) {
471 fl::size c, o;
locate(index, c, o);
475 const T&
at(fl::size index)
const {
476 if (index >=
mSize) {
479 fl::size c, o;
locate(index, c, o);
524 fl::size allocated = 0;
526 if (
mMap[i] !=
nullptr) ++allocated;
532 return static_cast<fl::size
>(-1) /
sizeof(T);
542 if (cur_chunks < needed_chunks) {
543 fl::size extra = needed_chunks - cur_chunks;
551 for (fl::size i = 0; i < extra; ++i) {
553 if (
mMap[first_new + i] ==
nullptr) {
580 if (i < mFrontMapIdx || i > last_used) {
590 for (fl::size i = 0; i <
mSize; ++i) {
591 fl::size c, o;
locate(i, c, o);
645 if (
mSize == 0)
return;
652 if (
mSize == 0)
return;
672 if (
this != &other) {
677 fl::size t_size =
mSize;
691 other.
mSize = t_size;
706 fl::size idx =
pos.mIndex;
709 return iterator(
this, idx);
714 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
715 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
717 (*this)[idx] =
value;
718 return iterator(
this, idx);
722 fl::size idx =
pos.mIndex;
725 return iterator(
this, idx);
730 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
731 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
734 return iterator(
this, idx);
738 fl::size idx =
pos.mIndex;
739 if (count == 0)
return iterator(
this, idx);
740 fl::size old_size =
mSize;
745 for (fl::size k = 0; k < count; ++k) {
750 for (fl::size i = old_size; i > idx; --i) {
751 (*this)[i - 1 + count] =
fl::move((*
this)[i - 1]);
753 for (fl::size i = 0; i < count; ++i) {
754 (*this)[idx + i] =
value;
756 return iterator(
this, idx);
761 fl::size idx =
pos.mIndex;
762 for (fl::size i = idx; i + 1 <
mSize; ++i) {
763 (*this)[i] =
fl::move((*
this)[i + 1]);
766 return iterator(
this, idx);
769 iterator
erase(const_iterator first, const_iterator last) {
770 fl::size start_idx = first.mIndex;
771 if (first == last)
return iterator(
this, start_idx);
772 fl::size count = last.mIndex - first.mIndex;
773 for (fl::size i = start_idx; i + count <
mSize; ++i) {
774 (*this)[i] =
fl::move((*
this)[i + count]);
776 for (fl::size k = 0; k < count; ++k) {
779 return iterator(
this, start_idx);
782 template<
typename... Args>
784 fl::size idx =
pos.mIndex;
787 return iterator(
this, idx);
792 for (fl::size i =
mSize - 1; i > idx + 1; --i) {
793 (*this)[i - 1] =
fl::move((*
this)[i - 2]);
796 return iterator(
this, idx);
799 template<
typename... Args>
810 template<
typename... Args>
826 for (fl::size i = 0; i < count; ++i) {
833 for (fl::size i = 0; i <
mSize; ++i) {
834 if ((*
this)[i] != other[i])
return false;
843 for (fl::size i = 0; i < min_size; ++i) {
844 if ((*
this)[i] < other[i])
return true;
845 if ((*
this)[i] > other[i])
return false;
const_iterator(const iterator &it)
const T & operator*() const
fl::size operator-(const const_iterator &other) const
const_iterator operator+(fl::size n) const
bool operator!=(const const_iterator &other) const
const_iterator & operator+=(fl::size n)
bool operator>(const const_iterator &other) const
const_iterator & operator--()
const T * operator->() const
bool operator<(const const_iterator &other) const
bool operator==(const const_iterator &other) const
const_iterator operator--(int)
const_iterator(const deque *dq, fl::size index)
bool operator<=(const const_iterator &other) const
const_iterator operator++(int)
const T & operator[](fl::size n) const
bool operator>=(const const_iterator &other) const
const_iterator & operator++()
const_iterator & operator-=(fl::size n)
fl::random_access_iterator_tag iterator_category
const_iterator operator-(fl::size n) const
iterator(deque *dq, fl::size index)
bool operator>=(const iterator &other) const
bool operator!=(const iterator &other) const
iterator & operator-=(fl::size n)
T & operator[](fl::size n) const
fl::random_access_iterator_tag iterator_category
bool operator<(const iterator &other) const
bool operator==(const iterator &other) const
bool operator>(const iterator &other) const
iterator & operator+=(fl::size n)
fl::size operator-(const iterator &other) const
iterator operator-(fl::size n) const
iterator operator+(fl::size n) const
bool operator<=(const iterator &other) const
bool operator>=(const deque &other) const FL_NO_EXCEPT
deque(fl::size count, const T &value=T())
memory_resource * mResource
iterator begin() FL_NO_EXCEPT
T & operator[](fl::size index)
void push_back(T &&value)
const_reverse_iterator crend() const FL_NO_EXCEPT
void ensure_back_room() FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
void deallocate_chunk(T *chunk) FL_NO_EXCEPT
void locate(fl::size logical_idx, fl::size &chunk_idx, fl::size &offset) const FL_NO_EXCEPT
void push_front(const T &value)
void push_front(T &&value)
fl::reverse_iterator< const_iterator > const_reverse_iterator
fl::reverse_iterator< iterator > reverse_iterator
void resize(fl::size new_size, const T &value)
iterator emplace(const_iterator pos, Args &&... args)
bool operator<(const deque &other) const
T & emplace_back(Args &&... args)
deque & operator=(deque &&other) FL_NO_EXCEPT
fl::size capacity() const
bool operator>(const deque &other) const FL_NO_EXCEPT
const_iterator end() const FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
static constexpr fl::size kChunkSize
bool operator==(const deque &other) const
fl::size size() const FL_NO_EXCEPT
void deallocate_map(T **map, fl::size capacity) FL_NO_EXCEPT
bool operator<=(const deque &other) const FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
void resize(fl::size new_size)
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
void ensure_front_room() FL_NO_EXCEPT
iterator insert(const_iterator pos, T &&value)
deque(deque &&other) FL_NO_EXCEPT
iterator erase(const_iterator first, const_iterator last)
iterator insert(const_iterator pos, fl::size count, const T &value)
const_iterator begin() const FL_NO_EXCEPT
T ** allocate_map(fl::size capacity) FL_NO_EXCEPT
const_iterator cend() const FL_NO_EXCEPT
const T & at(fl::size index) const
const_reverse_iterator crbegin() const FL_NO_EXCEPT
memory_resource * get_memory_resource() const FL_NO_EXCEPT
fl::size used_chunks() const FL_NO_EXCEPT
fl::size max_size() const
T & emplace_front(Args &&... args)
const_iterator cbegin() 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
bool operator!=(const deque &other) const FL_NO_EXCEPT
iterator insert(const_iterator pos, const T &value)
void assign(fl::size count, const T &value)
iterator erase(const_iterator pos)
void push_back(const T &value)
const T & operator[](fl::size index) const
deque & operator=(const deque &other) FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
deque(fl::initializer_list< T > init)
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 int type_rank< T >::value
void init(Context &ctx, int w, int h)
MapRedBlackTree< Key, T, Compare, fl::allocator_slab< char > > map
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
constexpr T && forward(typename remove_reference< T >::type &t) FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
Base definition for an LED controller.
static constexpr fl::size chunk_size