FastLED 3.10.6
Loading...
Searching...
No Matches

◆ copy() [2/4]

void fl::basic_string::copy ( const basic_string & other)

Definition at line 225 of file basic_string.cpp.hpp.

402 {
403 fl::size len = other.size();
404 if (other.hasHeapData()) {
405 // Share the heap pointer
406 const auto& otherHeap = other.mStorage.get<NotNullStringHolderPtr>();
407 mStorage = otherHeap;
408 } else if (len + 1 <= mInlineCapacity) {
409 if (!isInline()) {
410 mStorage.reset();
411 }
412 const char* src = other.c_str();
413 char* dst = inlineBufferPtr();
414 fl::memcpy(dst, src, len + 1);
415 } else {
417 }
418 mLength = len;
419}
fl::size mInlineCapacity
char * inlineBufferPtr() FL_NO_EXCEPT
bool isInline() const FL_NO_EXCEPT
fl::variant< NotNullStringHolderPtr, ConstLiteral, ConstView > mStorage
fl::not_null< StringHolderPtr > NotNullStringHolderPtr
void * memcpy(void *dest, const void *src, size_t n) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:414