FastLED 3.10.9
Loading...
Searching...
No Matches

◆ insert() [1/3]

template<typename T>
iterator fl::deque< T >::insert ( const_iterator pos,
const T & value )
inline

Definition at line 719 of file deque.h.

719 {
720 fl::size idx = pos.mIndex;
721 if (idx == mSize) {
723 return iterator(this, idx);
724 }
725 // Push a copy of the current back to extend by one; chunk alloc
726 // is handled inside push_back. On allocation failure leave the
727 // contents unchanged and return end() (FastLED #4899).
729 push_back((*this)[mSize - 1]);
730 if (mSize == old_size) return end();
731 for (fl::size i = mSize - 1; i > idx + 1; --i) {
732 (*this)[i - 1] = fl::move((*this)[i - 2]);
733 }
734 (*this)[idx] = value;
735 return iterator(this, idx);
736 }
void push_back(const T &value) FL_NO_EXCEPT
Definition deque.h:614
iterator end() FL_NO_EXCEPT
Definition deque.h:515
fl::size mSize
Definition deque.h:42
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition s16x16x4.h:30