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

Method move_from

src/fl/stl/basic_vector.cpp.hpp:474–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474void vector_basic::move_from(vector_basic& other) FL_NOEXCEPT {
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}
506
507void vector_basic::move_assign(vector_basic& other) FL_NOEXCEPT {
508 if (this == &other) return;

Callers 2

VectorNFunction · 0.80
vector_psramMethod · 0.80

Calls 3

hasInlineBufferMethod · 0.80
isInlineMethod · 0.45
inlineBufferPtrMethod · 0.45

Tested by

no test coverage detected