47 reinterpret_cast<uintptr_t
>(begin) & (
sizeof(
MemoryType) - 1);
49 return reinterpret_cast<T *
>(raw);
54 const uintptr_t shift_up =
55 reinterpret_cast<uintptr_t
>(begin) & (
sizeof(
MemoryType) - 1);
57 return reinterpret_cast<const T *
>(raw);
98 static_assert(M <= N,
"Too many elements for FixedVector");
103 if (
this != &other) {
118 const T *out =
nullptr;
159 for (
size_t i = 0; i < count; ++i) {
245 void *vp =
static_cast<void *
>(
p);
246 memset(vp, 0,
sizeof(T));
271 bool has(
const T &value)
const {
return find(value) !=
end(); }
289 if (
this != &other) {
291 for (
int i = 0; i <
max_size; ++i) {
325 return it != other.
it;
332 for (
size_t i = 0; i <
size; ++i) {
347 if (
this != &other) {
354 T *
begin = &values[0];
364 size_t new_capacity = (3 *
mCapacity) / 2;
365 if (new_capacity < n) {
368 T *ptr =
new T[new_capacity]();
370 for (
size_t i = 0; i <
mSize; ++i) {
375 mArray.reset(new_array.release());
404 for (
size_t i = 0; i < n; ++i) {
411 template <
typename InputIt,
416 for (InputIt it =
begin; it !=
end; ++it) {
421 void assign(
size_t new_cap,
const T &value) {
424 while (
size() < new_cap) {
469 reverse_iterator
rbegin() {
return reverse_iterator(
end()); }
471 reverse_iterator
rend() {
return reverse_iterator(
begin()); }
510 bool has(
const T &value)
const {
return find(value) !=
end(); }
519 while (
pos !=
end() - 1) {
536 T *temp =
mArray.release();
537 size_t temp_size =
mSize;
539 T *temp2 = other.
mArray.release();
544 other.
mSize = temp_size;
561 auto last =
end() - 1;
562 for (
size_t curr_idx = last -
begin(); curr_idx > target_idx;
564 auto first =
begin() + curr_idx - 1;
565 auto second =
begin() + curr_idx;
608 for (
size_t i = 0; i <
size(); ++i) {
617 return !(*
this == other);
639 if (needs_adjustment) {
684 while (first != last) {
685 iterator mid = first + (last - first) / 2;
687 if (
mLess(*mid, value)) {
715 bool has(
const T &value)
const {
return find(value) !=
end(); }
783 if (
size > INLINED_SIZE) {
792 if (
this != &other) {
800 if (
this != &other) {
801 if (other.mUsingHeap) {
802 mHeap.swap(other.mHeap);
805 mFixed.swap(other.mFixed);
814 if (
size > INLINED_SIZE) {
828 for (
auto &v :
mHeap) {
840 if (
size > INLINED_SIZE) {
854 for (
auto &v :
mHeap) {
871 void assign(
size_t new_cap,
const T &value) {
873 if (INLINED_SIZE > new_cap) {
875 while (
size() < new_cap) {
881 mHeap.reserve(new_cap);
883 while (
size() < new_cap) {
884 mHeap.push_back(value);
888 template <
typename InputIt,
892 if (uint32_t(
end -
begin) <= INLINED_SIZE) {
916 bool full()
const {
return INLINED_SIZE ==
size(); }
921 if (
mFixed.size() < INLINED_SIZE) {
926 mHeap.reserve(INLINED_SIZE * 2);
933 mHeap.push_back(value);
978 if (
mFixed.size() < INLINED_SIZE) {
987 mHeap.reserve(INLINED_SIZE * 2);
992 return mHeap.insert(
mHeap.begin() + idx, value);
1015 if (
this != &other) {
1030template <
typename T,
size_t INLINED_SIZE>
1033template <
typename T,
size_t INLINED_SIZE = 64>
const PairKV * const_iterator
FixedVector(const FixedVector &other)
constexpr size_t size() const
iterator find_if(Predicate pred)
InlinedMemoryBlock< PairKV, N > mMemoryBlock
FixedVector & operator=(const FixedVector &other)
FixedVector(FixedVector &&other)
void assign(const_iterator begin, const_iterator end)
T & operator[](size_t index)
const_iterator find(const T &value) const
bool has(const T &value) const
iterator erase(const T &value)
void swap(FixedVector< T, N > &other)
const_iterator data() const
constexpr bool empty() const
const T & operator[](size_t index) const
const_iterator end() const
const_iterator begin() const
FixedVector(const T(&values)[M])
void push_back(const T &value)
FixedVector(const T(&values)[N])
iterator erase(iterator pos)
constexpr size_t capacity() const
void assign_array(const T *values, size_t count)
bool insert(iterator pos, const T &value)
iterator find(const T &value)
bool operator==(const HeapVector< T > &other) const
const_iterator end() const
const_iterator find(const T &value) const
HeapVector(HeapVector< T > &&other)
const_iterator begin() const
void resize(size_t n, const T &value)
void assign(InputIt begin, InputIt end)
HeapVector(T(&values)[N])
bool insert(iterator pos, const T &value)
HeapVector(size_t size=0, const T &value=T())
void assign(size_t new_cap, const T &value)
T & operator[](size_t index)
void push_back(const T &value)
HeapVector & operator=(const HeapVector< T > &other)
bool erase(iterator pos, T *out_value=nullptr)
const T & operator[](size_t index) const
iterator find_if(Predicate pred)
void ensure_size(size_t n)
void swap(iterator a, iterator b)
bool operator!=(const HeapVector< T > &other) const
const DrawItem * const_iterator
iterator find(const T &value)
void swap(HeapVector< T > &other)
void erase(const T &value)
reverse_iterator rbegin()
fl::scoped_array< DrawItem > mArray
bool has(const T &value) const
HeapVector(const HeapVector< T > &other)
const_iterator begin() const
InlinedVector(size_t size)
void swap(InlinedVector &other)
void reserve(size_t size)
iterator find_if(Predicate pred)
void push_back(const T &value)
FixedVector< T, INLINED_SIZE > mFixed
const T & operator[](size_t idx) const
InlinedVector & operator=(const InlinedVector &other)
const_iterator end() const
InlinedVector(InlinedVector &&other)
void assign(size_t new_cap, const T &value)
InlinedVector(const InlinedVector &other)
typename FixedVector< T, INLINED_SIZE >::iterator iterator
bool insert(iterator pos, const T &value)
void assign(InputIt begin, InputIt end)
typename FixedVector< T, INLINED_SIZE >::const_iterator const_iterator
T & operator[](size_t idx)
InlinedVector & operator=(InlinedVector &&other)
SortedHeapVector(LessThan less=LessThan())
iterator lower_bound(const T &value)
HeapVector< Pair > mArray
bool erase(const T &value)
bool has(const T &value) const
void swap(SortedHeapVector &other)
const_iterator end() const
void setMaxSize(size_t n)
HeapVector< Pair >::const_iterator const_iterator
const_iterator begin() const
T & operator[](size_t index)
bool insert(const T &value, InsertResult *result=nullptr)
const_iterator lower_bound(const T &value) const
HeapVector< Pair >::iterator iterator
const T & operator[](size_t index) const
const_iterator find(const T &value) const
iterator find(const T &value)
Implements the FastLED namespace macros.
void swap(array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
InlinedVector< T, INLINED_SIZE > vector_inlined
typename enable_if< Condition, T >::type enable_if_t
FixedVector< T, INLINED_SIZE > vector_fixed
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
reverse_iterator(iterator i)
bool operator!=(const reverse_iterator &other) const
reverse_iterator & operator++()
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.