FastLED 3.9.15
Loading...
Searching...
No Matches

◆ insert()

template<typename T, size_t INLINED_SIZE>
bool fl::InlinedVector< T, INLINED_SIZE >::insert ( iterator pos,
const T & value )
inline

Definition at line 1018 of file vector.h.

1018 {
1019 if (mUsingHeap) {
1020 // return insert(pos, value);
1021 return mHeap.insert(pos, value);
1022 }
1023
1024 if (mFixed.size() < INLINED_SIZE) {
1025 return mFixed.insert(pos, value);
1026 }
1027
1028 // size_t diff = pos - mFixed.begin();
1029 // make safe for data that grows down
1030 size_t idx = mFixed.end() - pos;
1031
1032 // overflow: move inline data into heap
1033 mHeap.reserve(INLINED_SIZE * 2);
1034 for (auto &v : mFixed) {
1035 mHeap.push_back(v);
1036 }
1037 mFixed.clear();
1038 return mHeap.insert(mHeap.begin() + idx, value);
1039 }
HeapVector< T > mHeap
Definition vector.h:1071
FixedVector< T, INLINED_SIZE > mFixed
Definition vector.h:1070

References mFixed, mHeap, mUsingHeap, and pos.