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

◆ insert() [3/3]

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

Definition at line 738 of file deque.h.

738 {
739 fl::size idx = pos.mIndex;
740 if (idx == mSize) {
742 return iterator(this, idx);
743 }
744 // Move-extend at the back so move-only T works. The moved-from
745 // slot at old logical mSize-1 is overwritten by the shift loop.
746 // A failed push does not move from the back (FastLED #4899).
748 push_back(fl::move((*this)[mSize - 1]));
749 if (mSize == old_size) return end();
750 for (fl::size i = mSize - 1; i > idx + 1; --i) {
751 (*this)[i - 1] = fl::move((*this)[i - 2]);
752 }
753 (*this)[idx] = fl::move(value);
754 return iterator(this, idx);
755 }
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