FastLED 3.9.15
Loading...
Searching...
No Matches

◆ move_from()

void fl::vector_basic::move_from ( vector_basic & other)
protected

Move-steal contents from another vector_basic.

Definition at line 474 of file basic_vector.cpp.hpp.

474 {
475 if (other.isInline()) {
476 // Can't steal inline buffer — must move elements
477 reserve_impl(other.mSize);
478 if (mOps) {
479 mOps->uninitialized_move_n(mArray, other.mArray, other.mSize);
480 } else {
481 if (other.mSize > 0) {
482 trivial_copy(mArray, other.mArray, other.mSize);
483 }
484 }
485 mSize = other.mSize;
486 mResource = other.mResource;
487 other.mSize = 0;
488 } else {
489 // Steal heap pointer
490 mArray = other.mArray;
491 mSize = other.mSize;
492 mCapacity = other.mCapacity;
493 mResource = other.mResource;
494
495 // Leave other in valid empty state
496 if (other.hasInlineBuffer()) {
497 other.mArray = other.inlineBufferPtr();
498 other.mCapacity = other.mInlineCapacity;
499 } else {
500 other.mArray = nullptr;
501 other.mCapacity = 0;
502 }
503 other.mSize = 0;
504 }
505}
const vector_element_ops * mOps
void reserve_impl(fl::size n) FL_NOEXCEPT
memory_resource * mResource
void trivial_copy(void *dst, const void *src, fl::size count) const FL_NOEXCEPT

References vector_basic(), FL_NOEXCEPT, mArray, mCapacity, mOps, mResource, mSize, reserve_impl(), and trivial_copy().

Referenced by fl::vector< fl::i16 >::vector(), fl::vector_psram< T >::vector_psram(), fl::VectorN< T, INLINED_SIZE >::VectorN(), move_assign(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: