MCPcopy Create free account
hub / github.com/FastLED/FastLED / insert

Method insert

src/fl/stl/deque.h:579–597  ·  view source on GitHub ↗

Insert operations

Source from the content-addressed store, hash-verified

577
578 // Insert operations
579 iterator insert(const_iterator pos, const T& value) {
580 fl::size index = pos.mIndex;
581 ensure_capacity(mSize + 1);
582
583 // Shift elements from pos to end one position to the right
584 for (fl::size i = mSize; i > index; --i) {
585 fl::size from_idx = get_index(i - 1);
586 fl::size to_idx = get_index(i);
587 new (&mData[to_idx]) T(fl::move(mData[from_idx]));
588 mData[from_idx].~T();
589 }
590
591 // Insert new element
592 fl::size insert_idx = get_index(index);
593 new (&mData[insert_idx]) T(value);
594 ++mSize;
595
596 return iterator(this, index);
597 }
598
599 iterator insert(const_iterator pos, T&& value) {
600 fl::size index = pos.mIndex;

Callers

nothing calls this directly

Calls 1

iteratorClass · 0.70

Tested by

no test coverage detected