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

◆ insert() [1/2]

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

Definition at line 1134 of file vector.h.

1134 {
1135 if (mUsingHeap) {
1136 // return insert(pos, value);
1137 return mHeap.insert(pos, value);
1138 }
1139
1140 if (mFixed.size() < INLINED_SIZE) {
1141 return mFixed.insert(pos, value);
1142 }
1143
1144 // fl::size diff = pos - mFixed.begin();
1145 // make safe for data that grows down
1146 fl::size idx = mFixed.end() - pos;
1147
1148 // overflow: move inline data into heap
1149 mHeap.reserve(INLINED_SIZE * 2);
1150 for (auto &v : mFixed) {
1151 mHeap.push_back(v);
1152 }
1153 mFixed.clear();
1154 return mHeap.insert(mHeap.begin() + idx, value);
1155 }
HeapVector< T > mHeap
Definition vector.h:1211
FixedVector< T, INLINED_SIZE > mFixed
Definition vector.h:1210

References mFixed, mHeap, mUsingHeap, and pos.