FastLED 3.10.8
Loading...
Searching...
No Matches

◆ insert() [2/3]

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

Definition at line 737 of file deque.h.

737 {
738 fl::size idx = pos.mIndex;
739 if (count == 0) return iterator(this, idx);
741 // Extend by `count` slots. First push uses `value` if the deque
742 // is empty, else copies the current back; subsequent pushes copy
743 // whatever's at the back now. All these copies will be overwritten
744 // by the shift + fill below.
745 for (fl::size k = 0; k < count; ++k) {
746 if (mSize == 0) push_back(value);
747 else push_back((*this)[mSize - 1]);
748 }
749 // Shift elements [idx .. old_size) right by `count` slots.
750 for (fl::size i = old_size; i > idx; --i) {
751 (*this)[i - 1 + count] = fl::move((*this)[i - 1]);
752 }
753 for (fl::size i = 0; i < count; ++i) {
754 (*this)[idx + i] = value;
755 }
756 return iterator(this, idx);
757 }
void push_back(const T &value) FL_NO_EXCEPT
Definition deque.h:602
fl::size mSize
Definition deque.h:42
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition s16x16x4.h:30