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

◆ reserve()

void fl::basic_string::reserve ( fl::size newCapacity)

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

475 {
476 if (newCapacity <= mLength) return;
477 if (newCapacity + 1 <= mInlineCapacity) return;
478 if (hasHeapData()) {
479 const NotNullStringHolderPtr& heap = heapData();
480 if (heap.get().use_count() <= 1 && heap->hasCapacity(newCapacity)) {
481 return;
482 }
483 }
485 fl::memcpy(newData->data(), c_str(), mLength);
486 newData->data()[mLength] = '\0';
487 mStorage = newData;
488}
bool hasHeapData() const FL_NOEXCEPT
fl::size mInlineCapacity
NotNullStringHolderPtr & heapData() FL_NOEXCEPT
fl::variant< NotNullStringHolderPtr, ConstLiteral, ConstView > mStorage
const char * c_str() const 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 c_str(), fl::not_null< T >::get(), hasHeapData(), heapData(), fl::make_shared(), fl::memcpy(), mInlineCapacity, mLength, mStorage, and fl::shared_ptr< T >::use_count().

Referenced by fl::base64_encode(), fl::FileSystem::readText(), and resize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: