FastLED 3.10.8
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 481 of file basic_vector.cpp.hpp.

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

References vector_basic(), fl::FL_NO_EXCEPT, mArray, mCapacity, mOps, mResource, mSize, reserve_impl(), trivial_copy(), and uninitialized_move_n_impl().

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: