23template <
typename T, fl::size N>
56 return reinterpret_cast<T *
>(raw);
61 const fl::uptr shift_up =
64 return reinterpret_cast<const T *
>(raw);
77template <
typename T, fl::size N>
106 static_assert(M <= N,
"Too many elements for FixedVector");
112 if (init.size() > N) {
114 auto it = init.begin();
115 for (fl::size i = 0; i < N && it != init.end(); ++i, ++it) {
119 for (
const auto& value : init) {
126 if (
this != &other) {
141 const T *out =
nullptr;
191 for (fl::size i = 0; i < count; ++i) {
265 void *vp =
static_cast<void *
>(p);
285 void *vp =
static_cast<void *
>(p);
310 bool has(
const T &value)
const {
return find(value) !=
end(); }
328 if (
this != &other) {
330 for (fl::size i = 0; i <
max_size; ++i) {
344template <
typename T,
typename Allocator = fl::allocator<T>>
365 return it != other.
it;
377 for (fl::size i = 0; i <
size; ++i) {
392 if (
this != &other) {
400 T *
begin = &values[0];
406 template <
typename... Args>
414 for (
const auto& value : init) {
423 for (fl::size i = 0; i <
mSize; ++i) {
433 fl::size new_capacity = (3 *
mCapacity) / 2;
434 if (new_capacity < n) {
438 T* new_array =
mAlloc.allocate(new_capacity);
441 for (fl::size i = 0; i <
mSize; ++i) {
447 for (fl::size i = 0; i <
mSize; ++i) {
479 void resize(fl::size n,
const T &value) {
482 T* new_array =
mAlloc.allocate(n);
485 for (fl::size i = 0; i <
mSize; ++i) {
490 for (fl::size i =
mSize; i < n; ++i) {
491 mAlloc.construct(&new_array[i], value);
496 for (fl::size i = 0; i <
mSize; ++i) {
505 }
else if (n >
mSize) {
507 for (fl::size i =
mSize; i < n; ++i) {
511 }
else if (n <
mSize) {
513 for (fl::size i = n; i <
mSize; ++i) {
520 template <
typename InputIt,
524 u32 n =
static_cast<u32
>(
end -
begin);
526 for (InputIt it =
begin; it !=
end; ++it) {
531 void assign(fl::size new_cap,
const T &value) {
534 while (
size() < new_cap) {
577 for (fl::size i = 0; i <
mSize; ++i) {
597 reverse_iterator
rbegin() {
return reverse_iterator(
end()); }
599 reverse_iterator
rend() {
return reverse_iterator(
begin()); }
638 bool has(
const T &value)
const {
return find(value) !=
end(); }
647 while (
pos !=
end() - 1) {
686 fl::size target_idx =
pos -
begin();
688 auto last =
end() - 1;
689 for (fl::size curr_idx = last -
begin(); curr_idx > target_idx;
691 auto first =
begin() + curr_idx - 1;
692 auto second =
begin() + curr_idx;
701 fl::size target_idx =
pos -
begin();
703 auto last =
end() - 1;
704 for (fl::size curr_idx = last -
begin(); curr_idx > target_idx;
706 auto first =
begin() + curr_idx - 1;
707 auto second =
begin() + curr_idx;
733 for (fl::size i = 0; i <
size(); ++i) {
742 return !(*
this == other);
746template <
typename T,
typename LessThan = fl::less<T>>
765 if (needs_adjustment) {
810 while (first != last) {
811 iterator mid = first + (last - first) / 2;
813 if (
mLess(*mid, value)) {
841 bool has(
const T &value)
const {
return find(value) !=
end(); }
887template <
typename T, fl::size INLINED_SIZE>
910 if (
size > INLINED_SIZE) {
920 if (init.size() > INLINED_SIZE) {
921 mHeap.reserve(init.size());
922 for (const auto& value : init) {
923 mHeap.push_back(value);
927 for (
const auto& value : init) {
928 mFixed.push_back(value);
934 if (
this != &other) {
942 if (
this != &other) {
943 if (other.mUsingHeap) {
944 mHeap.swap(other.mHeap);
947 mFixed.swap(other.mFixed);
956 if (
size > INLINED_SIZE) {
970 for (
auto &v :
mHeap) {
982 if (
size > INLINED_SIZE) {
996 for (
auto &v :
mHeap) {
1013 void assign(fl::size new_cap,
const T &value) {
1015 if (INLINED_SIZE > new_cap) {
1017 while (
size() < new_cap) {
1023 mHeap.reserve(new_cap);
1025 while (
size() < new_cap) {
1026 mHeap.push_back(value);
1030 template <
typename InputIt,
1034 if (u32(
end -
begin) <= INLINED_SIZE) {
1066 mHeap.reserve(INLINED_SIZE + 1);
1073 mHeap.push_back(value);
1085 mHeap.reserve(INLINED_SIZE + 1);
1140 if (
mFixed.size() < INLINED_SIZE) {
1149 mHeap.reserve(INLINED_SIZE * 2);
1154 return mHeap.insert(
mHeap.begin() + idx, value);
1164 if (
mFixed.size() < INLINED_SIZE) {
1173 mHeap.reserve(INLINED_SIZE * 2);
1201 if (
this != &other) {
1216template <
typename T, fl::size INLINED_SIZE>
1219template <
typename T, fl::size INLINED_SIZE = 64>
const PairKV * const_iterator
FixedVector(const FixedVector &other)
iterator find_if(Predicate pred)
InlinedMemoryBlock< PairKV, N > mMemoryBlock
void assign_array(const PairKV *values, fl::size count)
bool insert(iterator pos, T &&value)
FixedVector & operator=(const FixedVector &other)
FixedVector(FixedVector &&other)
const T & operator[](fl::size index) const
constexpr fl::size size() const
void assign(const_iterator begin, const_iterator end)
const_iterator find(const T &value) const
bool has(const T &value) const
FixedVector(fl::initializer_list< T > init)
constexpr fl::size capacity() const
iterator erase(const T &value)
void swap(FixedVector< T, N > &other)
const_iterator data() const
constexpr bool empty() const
const_iterator end() const
const_iterator begin() const
void push_back(T &&value)
void push_back(const PairKV &value)
FixedVector(const T(&values)[N])
iterator erase(iterator pos)
FixedVector(T(&values)[M])
bool insert(iterator pos, const T &value)
iterator find(const PairKV &value)
T & operator[](fl::size index)
const T & operator[](fl::size index) const
HeapVector(T(&values)[N])
bool insert(iterator pos, T &&value)
fl::allocator< DrawItem > mAlloc
reverse_iterator rbegin()
HeapVector(HeapVector< T > &&other)
bool insert(iterator pos, const T &value)
void assign(InputIt begin, InputIt end)
HeapVector(const HeapVector< T > &other)
void swap(HeapVector< T > &&other)
void resize(fl::size n, const T &value)
void ensure_size(fl::size n)
const DrawItem * const_iterator
void push_back(T &&value)
bool erase(iterator pos, T *out_value=nullptr)
void swap(HeapVector< DrawItem > &other)
T & operator[](fl::size index)
const_iterator end() const
bool operator==(const HeapVector< T > &other) const
const_iterator begin() const
void swap(iterator a, iterator b)
void assign(fl::size new_cap, const T &value)
iterator find(const T &value)
HeapVector & operator=(const HeapVector< T > &other)
iterator find_if(Predicate pred)
fl::size capacity() const
bool has(const T &value) const
const_iterator find(const T &value) const
void push_back(const DrawItem &value)
void emplace_back(Args &&... args)
void erase(const T &value)
HeapVector(fl::initializer_list< T > init)
bool operator!=(const HeapVector< T > &other) const
HeapVector(fl::size size, const T &value=T())
const_iterator begin() const
void swap(InlinedVector &other)
iterator find_if(Predicate pred)
InlinedVector(fl::initializer_list< T > init)
void reserve(fl::size size)
void push_back(const T &value)
FixedVector< T, INLINED_SIZE > mFixed
InlinedVector & operator=(const InlinedVector &other)
const_iterator end() const
InlinedVector(InlinedVector &&other)
void push_back(T &&value)
InlinedVector(const InlinedVector &other)
typename FixedVector< T, INLINED_SIZE >::iterator iterator
InlinedVector(fl::size size)
bool insert(iterator pos, const T &value)
const T & operator[](fl::size idx) const
bool insert(iterator pos, T &&value)
void assign(InputIt begin, InputIt end)
T & operator[](fl::size idx)
void resize(fl::size size)
typename FixedVector< T, INLINED_SIZE >::const_iterator const_iterator
void assign(fl::size new_cap, const T &value)
InlinedVector & operator=(InlinedVector &&other)
SortedHeapVector(LessThan less=LessThan())
iterator lower_bound(const value_type &value)
HeapVector< value_type > mArray
bool erase(const T &value)
const T & operator[](fl::size index) const
T & operator[](fl::size index)
bool has(const T &value) const
void swap(SortedHeapVector &other)
const_iterator end() const
HeapVector< value_type >::const_iterator const_iterator
const_iterator begin() const
fl::size capacity() const
bool insert(const T &value, InsertResult *result=nullptr)
void setMaxSize(fl::size n)
const_iterator lower_bound(const T &value) const
HeapVector< value_type >::iterator iterator
const_iterator find(const T &value) const
iterator find(const T &value)
Result type for promise operations.
Implements the FastLED namespace macros.
constexpr remove_reference< T >::type && move(T &&t) noexcept
void swap(array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
InlinedVector< T, INLINED_SIZE > vector_inlined
void clear(CRGB(&arr)[N])
constexpr T * begin(T(&array)[N]) noexcept
void * memfill(void *ptr, int value, fl::size num)
constexpr T * end(T(&array)[N]) noexcept
HeapVector< T, Allocator > vector
typename enable_if< Condition, T >::type enable_if_t
FixedVector< T, INLINED_SIZE > vector_fixed
constexpr T && forward(typename remove_reference< T >::type &t) noexcept
reverse_iterator & operator++()
bool operator!=(const reverse_iterator &other) const
reverse_iterator(iterator i)
InlinedMemoryBlock(InlinedMemoryBlock &&other)=default
InlinedMemoryBlock(const InlinedMemoryBlock &other)=default
MemoryType mMemoryBlock[kBlockSize]
Binary function object that returns whether the first argument is less than the second.