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 972 of file vector.h.

972 {
973 if (mUsingHeap) {
974 // return insert(pos, value);
975 return mHeap.insert(pos, value);
976 }
977
978 if (mFixed.size() < INLINED_SIZE) {
979 return mFixed.insert(pos, value);
980 }
981
982 // size_t diff = pos - mFixed.begin();
983 // make safe for data that grows down
984 size_t idx = mFixed.end() - pos;
985
986 // overflow: move inline data into heap
987 mHeap.reserve(INLINED_SIZE * 2);
988 for (auto &v : mFixed) {
989 mHeap.push_back(v);
990 }
991 mFixed.clear();
992 return mHeap.insert(mHeap.begin() + idx, value);
993 }
HeapVector< T > mHeap
Definition vector.h:1025
FixedVector< T, INLINED_SIZE > mFixed
Definition vector.h:1024

References mFixed, mHeap, mUsingHeap, and pos.