27template <
typename T, fl::size Extent>
class span;
31template <
typename T, fl::size N>
32struct FL_ALIGNAS(alignof(T) > alignof(
fl::uptr) ? alignof(T) : alignof(fl::uptr)) InlinedMemoryBlock {
34 typedef fl::uptr MemoryType;
36 kTotalBytes = N *
sizeof(T),
40 kTotalBytesAligned = kTotalBytes + kExtraSize,
41 kBlockSize = (kTotalBytesAligned +
sizeof(MemoryType) - 1) /
sizeof(MemoryType),
45 fl::memset(mMemoryBlock, 0,
sizeof(mMemoryBlock));
51 InlinedMemoryBlock(
const InlinedMemoryBlock &other)
FL_NO_EXCEPT =
default;
52 InlinedMemoryBlock(InlinedMemoryBlock &&other)
FL_NO_EXCEPT =
default;
57 MemoryType mMemoryBlock[kBlockSize];
60 MemoryType *
begin = &mMemoryBlock[0];
63 MemoryType *raw =
begin + shift_up;
68 const MemoryType *
begin = &mMemoryBlock[0];
69 const fl::uptr shift_up =
71 const MemoryType *raw =
begin + shift_up;
85template <
typename T, fl::size N>
121 if (
init.size() > N) {
123 auto it =
init.begin();
124 for (fl::size i = 0; i < N && it !=
init.end(); ++i, ++it) {
137 fl::size count = s.size() < N ? s.size() : N;
138 for (fl::size i = 0; i < count; ++i) {
144 if (
this != &other) {
151 if (
this != &other) {
167 const T *out =
nullptr;
209 template<
typename... Args>
227 for (fl::size i = 0; i < count; ++i) {
368 return it == other.it;
371 return it != other.it;
385 return it == other.it;
388 return it != other.it;
410 if (
this == &other)
return;
414 for (fl::size i = 0; i < min_sz; ++i) {
419 for (fl::size i = min_sz; i < max_sz; ++i) {
421 T* dst = other.memory() + i;
426 for (fl::size i = min_sz; i < max_sz; ++i) {
427 T* src = other.memory() + i;
435 other.current_size = temp_size;
465 return it == other.it;
468 return it != other.it;
482 return it == other.it;
485 return it != other.it;
532 for (fl::size i = 0; i < N; ++i) {
549 template <
typename InputIterator,
554 for (
auto it = first; it != last; ++it) {
564 for (fl::size i = 0; i < s.size(); ++i) {
572 if (
this != &other) {
579 if (
this != &other) {
606 return static_cast<T*
>(
mArray)[index];
610 return static_cast<const T*
>(
mArray)[index];
627 template <
typename... Args>
636 template <
typename InputIt,
640 for (
auto it = first; it != last; ++it) {
648 for (fl::size i = 0; i < new_cap; ++i) {
659 return mArray ?
static_cast<const T*
>(
mArray) :
nullptr;
674 return mArray ?
static_cast<const T*
>(
mArray) :
nullptr;
684 if (*it ==
value)
return it;
691 if (*it ==
value)
return it;
698 if (pred(*it))
return it;
712 return begin() + index;
734 if (count == 0 || first >=
end())
return;
735 fl::size index = first -
begin();
736 if (index + count >
mSize) count =
mSize - index;
744 fl::size old_size =
mSize;
746 return mSize > old_size;
751 fl::size old_size =
mSize;
753 return mSize > old_size;
757 template <
typename InputIt>
759 fl::size target_idx =
pos -
begin();
761 for (InputIt it = first; it != last; ++it) {
762 fl::size old_size =
mSize;
764 if (
mSize == old_size) {
770 return begin() + target_idx;
773 fl::size src_start =
mSize - count;
774 for (fl::size i = 0; i < count; ++i) {
775 for (fl::size j = src_start + i; j > target_idx + i; --j) {
777 static_cast<T*
>(
mArray)[j]);
780 return begin() + target_idx;
795 if (
size() != other.size())
return false;
796 const T* a =
static_cast<const T*
>(
mArray);
797 const T* b =
static_cast<const T*
>(other.mArray);
798 for (fl::size i = 0; i <
size(); ++i) {
799 if (a[i] != b[i])
return false;
807 fl::size min_size =
mSize < other.mSize ?
mSize : other.mSize;
808 const T* a =
static_cast<const T*
>(
mArray);
809 const T* b =
static_cast<const T*
>(other.mArray);
810 for (fl::size i = 0; i < min_size; ++i) {
811 if (a[i] < b[i])
return true;
812 if (a[i] > b[i])
return false;
814 return mSize < other.mSize;
818 return *
this < other || *
this == other;
824 return *
this > other || *
this == other;
846template <
typename T, fl::size INLINED_SIZE>
851 FL_ALIGNAS(
alignof(T) >
alignof(fl::uptr) ?
alignof(T) :
alignof(fl::uptr))
852 char mInlineBuffer[INLINED_SIZE *
sizeof(T)] = {};
862 :
vector<T>(mInlineBuffer, INLINED_SIZE) {}
865 :
vector<T>(mInlineBuffer, INLINED_SIZE, resource) {}
868 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
873 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
877 template <fl::size M>
879 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
884 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
889 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
894 :
vector<T>(mInlineBuffer, INLINED_SIZE) {
902 if (
this != &other) {
909 if (
this != &other) {
938 template <
typename InputIterator,
942 for (
auto it = first; it != last; ++it) {
958 if (
this != &other) {
965 if (
this != &other) {
976template <
typename T,
typename LessThan = fl::less<T>>
1005 other.mMaxSize = fl::size(-1);
1010 if (
this != &other) {
1014 other.mMaxSize = fl::size(-1);
1023 if (needs_adjustment) {
1053 while (first != last) {
1054 iterator mid = first + (last - first) / 2;
1133template <
typename T, fl::size INLINED_SIZE>
1136template <
typename T, fl::size INLINED_SIZE = 64>
1140template <
typename T, fl::size INLINED_SIZE>
Alignment macros and utilities for FastLED.
Type-erased base class for fl::vector<T>.
void swap(FixedVector< T, N > &other) FL_NO_EXCEPT
const T * memory() const FL_NO_EXCEPT
const fl::u32 * const_iterator
const T & operator[](fl::size index) const FL_NO_EXCEPT
iterator end() FL_NO_EXCEPT
const T & back() const FL_NO_EXCEPT
FixedVector(FixedVector &&other) FL_NO_EXCEPT
const_iterator find(const T &value) const FL_NO_EXCEPT
InlinedMemoryBlock< fl::u32, N > mMemoryBlock
FixedVector(const FixedVector &other) FL_NO_EXCEPT
~FixedVector() FL_NO_EXCEPT
void resize(fl::size n) FL_NO_EXCEPT
const_iterator end() const FL_NO_EXCEPT
T & operator[](fl::size index) FL_NO_EXCEPT
iterator find(const fl::u32 &value) FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
const T & front() const FL_NO_EXCEPT
constexpr bool empty() const FL_NO_EXCEPT
bool insert(iterator pos, T &&value) FL_NO_EXCEPT
FixedVector(fl::initializer_list< T > init) FL_NO_EXCEPT
void push_back(T &&value) FL_NO_EXCEPT
FixedVector(const T(&values)[N]) FL_NO_EXCEPT
void shrink_to_fit() FL_NO_EXCEPT
iterator find_if(Predicate pred) FL_NO_EXCEPT
iterator data() FL_NO_EXCEPT
FixedVector(T(&values)[M]) FL_NO_EXCEPT
T * memory() FL_NO_EXCEPT
FixedVector & operator=(FixedVector &&other) FL_NO_EXCEPT
constexpr FixedVector() FL_NO_EXCEPT
FixedVector(fl::span< const T, fl::size(-1)> s) FL_NO_EXCEPT
void clear() FL_NO_EXCEPT
void push_back(const fl::u32 &value) FL_NO_EXCEPT
constexpr fl::size size() const FL_NO_EXCEPT
bool insert(iterator pos, const T &value) FL_NO_EXCEPT
const_iterator data() const FL_NO_EXCEPT
iterator erase(iterator pos) FL_NO_EXCEPT
void assign_array(const fl::u32 *values, fl::size count) FL_NO_EXCEPT
void emplace_back(Args &&... args) FL_NO_EXCEPT
FixedVector & operator=(const FixedVector &other) FL_NO_EXCEPT
const_iterator begin() const FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
iterator erase(const T &value) FL_NO_EXCEPT
constexpr fl::size capacity() const FL_NO_EXCEPT
iterator begin() FL_NO_EXCEPT
void pop_back() FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
bool has(const T &value) const FL_NO_EXCEPT
void assign(const_iterator begin, const_iterator end) FL_NO_EXCEPT
void reserve(fl::size n) FL_NO_EXCEPT
SortedHeapVector(SortedHeapVector &&other) FL_NO_EXCEPT
~SortedHeapVector() FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
vector< T >::iterator iterator
iterator begin() FL_NO_EXCEPT
vector< T >::const_iterator const_iterator
void setMaxSize(fl::size n) FL_NO_EXCEPT
const T * data() const FL_NO_EXCEPT
iterator end() FL_NO_EXCEPT
fl::size size() const FL_NO_EXCEPT
SortedHeapVector & operator=(const SortedHeapVector &other)=default
vector< T >::const_reverse_iterator const_reverse_iterator
iterator lower_bound(const T &value) FL_NO_EXCEPT
void reserve(fl::size n) FL_NO_EXCEPT
bool has(const T &value) const FL_NO_EXCEPT
vector< T >::reverse_iterator reverse_iterator
const_iterator end() const FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
const T & front() const FL_NO_EXCEPT
const_iterator find(const T &value) const FL_NO_EXCEPT
SortedHeapVector(const SortedHeapVector &other)=default
bool full() const FL_NO_EXCEPT
T & operator[](fl::size index) FL_NO_EXCEPT
const T & back() const FL_NO_EXCEPT
void clear() FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
iterator erase(iterator pos) FL_NO_EXCEPT
void swap(SortedHeapVector &other) FL_NO_EXCEPT
iterator find(const T &value) FL_NO_EXCEPT
fl::size capacity() const FL_NO_EXCEPT
bool erase(const T &value) FL_NO_EXCEPT
bool insert(const T &value, insert_result *result=nullptr) FL_NO_EXCEPT
const_iterator lower_bound(const T &value) const FL_NO_EXCEPT
SortedHeapVector(LessThan less=LessThan()) FL_NO_EXCEPT
bool empty() const FL_NO_EXCEPT
SortedHeapVector & operator=(SortedHeapVector &&other) FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
const_iterator begin() const FL_NO_EXCEPT
const T & operator[](fl::size index) const FL_NO_EXCEPT
VectorN(fl::size count, const T &value=T()) FL_NO_EXCEPT
VectorN & operator=(const VectorN &other) FL_NO_EXCEPT
VectorN(memory_resource *resource) FL_NO_EXCEPT
VectorN & operator=(VectorN &&other) FL_NO_EXCEPT
VectorN(VectorN &&other) FL_NO_EXCEPT
VectorN(const vector< T > &other) FL_NO_EXCEPT
T * inline_memory() FL_NO_EXCEPT
VectorN(const VectorN &other) FL_NO_EXCEPT
VectorN(const VectorN< T, M > &other) FL_NO_EXCEPT
FL_ALIGNAS(alignof(T) > alignof(fl::uptr) ? alignof(T) :alignof(fl::uptr)) char mInlineBuffer[INLINED_SIZE *sizeof(T)]
VectorN(fl::initializer_list< T > init) FL_NO_EXCEPT
Polymorphic memory resource base class (PMR-style).
void move_assign(vector_basic &other) FL_NO_EXCEPT
Move-assign from another vector_basic (clears this first).
fl::size size() const FL_NO_EXCEPT
void resize_impl(fl::size n) FL_NO_EXCEPT
Resize to n elements. New elements are default-constructed (zeroed for trivial).
void resize_value_impl(fl::size n, const void *value) FL_NO_EXCEPT
Resize to n elements. New elements are copy-constructed from value.
void push_back_move_impl(void *element) FL_NO_EXCEPT
void shrink_to_fit_impl() FL_NO_EXCEPT
void push_back_copy_impl(const void *element) FL_NO_EXCEPT
void insert_move_impl(fl::size index, void *element) FL_NO_EXCEPT
Insert element at index by move. Shifts subsequent elements right.
void copy_from(const vector_basic &other) FL_NO_EXCEPT
Copy all elements from another vector_basic.
memory_resource * mResource
void swap_impl(vector_basic &other) FL_NO_EXCEPT
Swap contents with another vector_basic.
vector_basic(fl::size elementSize, memory_resource *resource, const vector_element_ops *ops) FL_NO_EXCEPT
Heap-only vector (no inline buffer).
bool empty() const FL_NO_EXCEPT
void clear_impl() FL_NO_EXCEPT
void reserve_impl(fl::size n) FL_NO_EXCEPT
void erase_impl(fl::size index) FL_NO_EXCEPT
Erase element at index. Shifts subsequent elements left.
void erase_range_impl(fl::size first_index, fl::size count) FL_NO_EXCEPT
Erase range [first_index, first_index + count).
void move_from(vector_basic &other) FL_NO_EXCEPT
Move-steal contents from another vector_basic.
void pop_back_impl() FL_NO_EXCEPT
void insert_copy_impl(fl::size index, const void *element) FL_NO_EXCEPT
Insert element at index by copy. Shifts subsequent elements right.
vector_psram & operator=(vector_psram &&other) FL_NO_EXCEPT
vector_psram(fl::size count, const T &value=T()) FL_NO_EXCEPT
vector_psram(fl::initializer_list< T > init) FL_NO_EXCEPT
vector_psram(const vector_psram &other) FL_NO_EXCEPT
vector_psram(vector_psram &&other) FL_NO_EXCEPT
vector_psram(InputIterator first, InputIterator last) FL_NO_EXCEPT
vector_psram & operator=(const vector_psram &other) FL_NO_EXCEPT
vector_psram() FL_NO_EXCEPT
iterator find_if(Predicate pred) FL_NO_EXCEPT
vector(span< const T, fl::size(-1)> s) FL_NO_EXCEPT
bool has(const T &value) const FL_NO_EXCEPT
const_iterator find(const T &value) const FL_NO_EXCEPT
const fl::i16 * const_iterator
void reserve(fl::size n) FL_NO_EXCEPT
void erase_range(iterator first, fl::size count) FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
vector & operator=(vector &&other) FL_NO_EXCEPT
void shrink_to_fit() FL_NO_EXCEPT
void push_back(T &&value) FL_NO_EXCEPT
vector(T(&values)[N]) FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
vector(void *inlineBuffer, fl::size inlineCapacity, memory_resource *resource) FL_NO_EXCEPT
void emplace_back(Args &&... args) FL_NO_EXCEPT
vector(fl::initializer_list< T > init) FL_NO_EXCEPT
const_iterator cend() const FL_NO_EXCEPT
vector(void *inlineBuffer, fl::size inlineCapacity) FL_NO_EXCEPT
void resize(fl::size n) FL_NO_EXCEPT
memory_resource * get_resource() const FL_NO_EXCEPT
vector(const vector &other) FL_NO_EXCEPT
void pop_back() FL_NO_EXCEPT
void clear() FL_NO_EXCEPT
bool operator<=(const vector &other) const FL_NO_EXCEPT
const T * data() const FL_NO_EXCEPT
const_iterator end() const FL_NO_EXCEPT
void push_back(const fl::i16 &value) FL_NO_EXCEPT
void swap(iterator a, iterator b) FL_NO_EXCEPT
iterator find(const T &value) FL_NO_EXCEPT
iterator end() FL_NO_EXCEPT
void assign(fl::size new_cap, const T &value) FL_NO_EXCEPT
vector(fl::size count, const T &value=T()) FL_NO_EXCEPT
iterator erase(iterator pos) FL_NO_EXCEPT
void assign(InputIt first, InputIt last) FL_NO_EXCEPT
vector(memory_resource *resource) FL_NO_EXCEPT
vector(fl::size count, const T &value, memory_resource *resource) FL_NO_EXCEPT
const T & back() const FL_NO_EXCEPT
bool operator!=(const vector &other) const FL_NO_EXCEPT
void swap(vector &other) FL_NO_EXCEPT
bool insert(iterator pos, T &&value) FL_NO_EXCEPT
bool operator>(const vector &other) const FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
iterator begin() FL_NO_EXCEPT
const T & operator[](fl::size index) const FL_NO_EXCEPT
bool operator>=(const vector &other) const FL_NO_EXCEPT
T & operator[](fl::size index) FL_NO_EXCEPT
bool erase(iterator pos, T *out_value) FL_NO_EXCEPT
void ensure_size(fl::size n) FL_NO_EXCEPT
bool operator==(const vector &other) const FL_NO_EXCEPT
vector(InputIterator first, InputIterator last) FL_NO_EXCEPT
void resize(fl::size n, const T &value) FL_NO_EXCEPT
iterator insert(iterator pos, InputIt first, InputIt last) FL_NO_EXCEPT
vector(vector &&other) FL_NO_EXCEPT
const T & front() const FL_NO_EXCEPT
void swap(vector &&other) FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
void erase(const T &value) FL_NO_EXCEPT
vector & operator=(const vector &other) FL_NO_EXCEPT
const_iterator begin() const FL_NO_EXCEPT
bool operator<(const vector &other) const FL_NO_EXCEPT
const_iterator cbegin() const FL_NO_EXCEPT
bool insert(iterator pos, const T &value) FL_NO_EXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
constexpr T * begin(T(&array)[N]) 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
max_align_selector<(sizeof(longdouble)>sizeof(double))>::type max_align_t
typename enable_if< Condition, T >::type enable_if_t
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
void swap(array< T, N > &lhs, array< T, N > &rhs) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
constexpr int type_rank< T >::value
VectorN< T, INLINED_SIZE > InlinedVector
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
const vector_element_ops * vector_element_ops_for() FL_NO_EXCEPT
Generate a static ops table for type T.
void init(Context &ctx, int w, int h) FL_NO_EXCEPT
FASTLED_FORCE_INLINE void * memset(void *s, int c, size_t n) FL_NO_EXCEPT
memory_resource * default_memory_resource() FL_NO_EXCEPT
Get the default memory resource (wraps fl::Malloc / fl::Free / fl::realloc).
memory_resource * psram_memory_resource() FL_NO_EXCEPT
Get the PSRAM memory resource (wraps PSRamAllocate / PSRamDeallocate).
expected< T, E > result
Alias for expected (Rust-style naming)
struct FL_ALIGNAS(4) Wave3BitExpansionLut
Lookup table for nibble-to-waveform expansion in wave3 format (32 bytes)
uptr ptr_to_int(T *ptr) FL_NO_EXCEPT
To bit_cast(const From &from) FL_NO_EXCEPT
VectorN< T, INLINED_SIZE > vector_inlined
FixedVector< T, INLINED_SIZE > vector_fixed
Base definition for an LED controller.
#define FL_STATIC_ASSERT(...)
Portable compile-time assertion wrapper.
bool operator!=(const const_reverse_iterator &other) const FL_NO_EXCEPT
const T & operator*() const FL_NO_EXCEPT
bool operator==(const const_reverse_iterator &other) const FL_NO_EXCEPT
const_reverse_iterator(const_iterator i) FL_NO_EXCEPT
const_reverse_iterator & operator++() FL_NO_EXCEPT
const T * operator->() const FL_NO_EXCEPT
bool operator==(const reverse_iterator &other) const FL_NO_EXCEPT
reverse_iterator & operator++() FL_NO_EXCEPT
reverse_iterator(iterator i) FL_NO_EXCEPT
T & operator*() FL_NO_EXCEPT
bool operator!=(const reverse_iterator &other) const FL_NO_EXCEPT
T * operator->() FL_NO_EXCEPT
Binary function object that returns whether the first argument is less than the second.
const_reverse_iterator(const_iterator i) FL_NO_EXCEPT
const T * operator->() const FL_NO_EXCEPT
const T & operator*() const FL_NO_EXCEPT
bool operator!=(const const_reverse_iterator &other) const FL_NO_EXCEPT
bool operator==(const const_reverse_iterator &other) const FL_NO_EXCEPT
const_reverse_iterator & operator++() FL_NO_EXCEPT
reverse_iterator & operator++() FL_NO_EXCEPT
bool operator==(const reverse_iterator &other) const FL_NO_EXCEPT
T & operator*() FL_NO_EXCEPT
reverse_iterator(iterator i) FL_NO_EXCEPT
T * operator->() FL_NO_EXCEPT
bool operator!=(const reverse_iterator &other) const FL_NO_EXCEPT