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

◆ shrink_to_fit()

void fl::basic_string::shrink_to_fit ( )

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

500 {
501 if (hasHeapData()) {
503 if (heap.get().use_count() > 1) return;
504 if (heap->capacity() <= mLength + 1) return;
505 if (mLength + 1 <= mInlineCapacity) {
506 fl::memcpy(inlineBufferPtr(), heap->data(), mLength + 1);
507 mStorage.reset();
508 return;
509 }
511 fl::memcpy(newData->data(), heap->data(), mLength + 1);
512 mStorage = newData;
513 }
514}
bool hasHeapData() const FL_NOEXCEPT
fl::size mInlineCapacity
NotNullStringHolderPtr & heapData() FL_NOEXCEPT
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

References fl::not_null< T >::get(), hasHeapData(), heapData(), inlineBufferPtr(), fl::make_shared(), fl::memcpy(), mInlineCapacity, mLength, mStorage, and fl::shared_ptr< T >::use_count().

+ Here is the call graph for this function: