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

◆ emplace()

template<typename T>
template<typename... Args>
iterator fl::deque< T >::emplace ( const_iterator pos,
Args &&... args )
inline

Definition at line 809 of file deque.h.

809 {
810 fl::size idx = pos.mIndex;
811 if (idx == mSize) {
813 return iterator(this, idx); // end() if the append failed
814 }
815 // Move-extend at the back so move-only T works. The moved-from
816 // slot at old logical mSize-1 is overwritten by the shift loop.
817 // A failed push does not move from the back (FastLED #4899).
819 push_back(fl::move((*this)[mSize - 1]));
820 if (mSize == old_size) return end();
821 for (fl::size i = mSize - 1; i > idx + 1; --i) {
822 (*this)[i - 1] = fl::move((*this)[i - 2]);
823 }
824 (*this)[idx] = T(fl::forward<Args>(args)...);
825 return iterator(this, idx);
826 }
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
void emplace_back(Args &&... args) FL_NO_EXCEPT
Definition deque.h:831
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition s16x16x4.h:30