FastLED 3.9.15
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.

378 {
379 fl::size len = other.size();
380 if (other.hasHeapData()) {
381 // Share the heap pointer
382 const auto& otherHeap = other.mStorage.get<NotNullStringHolderPtr>();
383 mStorage = otherHeap;
384 } else if (len + 1 <= mInlineCapacity) {
385 if (!isInline()) {
386 mStorage.reset();
387 }
388 const char* src = other.c_str();
389 char* dst = inlineBufferPtr();
390 fl::memcpy(dst, src, len + 1);
391 } else {
393 }
394 mLength = len;
395}
bool isInline() const FL_NOEXCEPT
fl::size mInlineCapacity
fl::variant< NotNullStringHolderPtr, ConstLiteral, ConstView > mStorage
char * inlineBufferPtr() FL_NOEXCEPT
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
fl::not_null< StringHolderPtr > NotNullStringHolderPtr
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414