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

◆ insert() [2/2]

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

Definition at line 1158 of file vector.h.

1158 {
1159 if (mUsingHeap) {
1160 // return insert(pos, value);
1161 return mHeap.insert(pos, fl::move(value));
1162 }
1163
1164 if (mFixed.size() < INLINED_SIZE) {
1165 return mFixed.insert(pos, fl::move(value));
1166 }
1167
1168 // fl::size diff = pos - mFixed.begin();
1169 // make safe for data that grows down
1170 fl::size idx = mFixed.end() - pos;
1171
1172 // overflow: move inline data into heap
1173 mHeap.reserve(INLINED_SIZE * 2);
1174 for (auto &v : mFixed) {
1175 mHeap.push_back(v);
1176 }
1177 mFixed.clear();
1178 return mHeap.insert(mHeap.begin() + idx, fl::move(value));
1179 }
HeapVector< T > mHeap
Definition vector.h:1211
FixedVector< T, INLINED_SIZE > mFixed
Definition vector.h:1210

References mFixed, mHeap, fl::move(), mUsingHeap, and pos.

+ Here is the call graph for this function: