13 template<
class traits_t>
 
   19         "The buffer size should be such that the final size of the structure is aligned");
 
   22         return m_Buffer.data();
 
   27 template<
class traits_t>
 
   40 template<
class traits_t>
 
   45     typename traits_t::size_type nSymbolsToAllocate =
 
   46         nAlign > 0 ? nAlign * ((nSymbols + 1) / nAlign + 1) : nSymbols + 1;
 
   48     if (eType == string_resize_type::shrink_to_fit 
 
   50         || nSymbolsToAllocate > capacity())        
 
   52         const bool      bSmallAtStart = is_small();
 
   53         const size_type nNewSize      = nSymbolsToAllocate * 
sizeof(value_type);
 
   57         if (nSymbolsToAllocate <= m_Buffer.size())
 
   59             if (!bSmallAtStart && (traits_t::shrink_to_fit_when_small() || eType == string_resize_type::shrink_to_fit))
 
   62                 std::memmove(buff.data(), m_pData, nNewSize);
 
   67             m_nSize = nSymbolsToAllocate - 1;
 
   71             size_type nStartSize = 0;
 
   75                 nStartSize = size() * 
sizeof(value_type);
 
   78             if (
void* pNewBlock = std::realloc(bSmallAtStart ? 
nullptr : m_pData, nNewSize))
 
   80                 m_nAllocatedSize = nSymbolsToAllocate;
 
   81                 m_pData          = 
static_cast<typename traits_t::value_type*
>(pNewBlock);
 
   84                     std::memmove(m_pData, buff.data(), nStartSize);
 
   93     if (bRet && eType == string_resize_type::common)
 
   99 template<
class traits_t>
 
  105 template<
class traits_t>
 
  109         return m_Buffer.size();
 
  111         return m_nAllocatedSize;
 
  114 template<
class traits_t>
 
  117     return m_nAllocatedSize == 0;
 
bool resize(size_type nSymbols, size_type nAlign, string_resize_type eType) noexcept
Resize string data.
 
size_type size() const noexcept
Get string length.
 
bool is_small() const noexcept
Is string small and fits in the local buffer.
 
void free() noexcept
Free allocated memory.
 
pointer data() noexcept
Get string data: from buffer or from pointer.
 
size_type capacity() const noexcept
Get capacity of string.