19 enum class sbo_resize_type
35 template<
class traits_t>
39 using traits_type = traits_t;
40 using size_type =
typename traits_type::size_type;
43 static constexpr size_type nSBOSize = traits_type::nSBOSize;
44 static_assert(nSBOSize >= 32);
47 static constexpr
bool bShrinkToFitWhenSmall = traits_type::bShrinkToFitWhenSmall;
49 static constexpr size_type nBufferSize = nSBOSize - 2 *
sizeof(size_type);
50 using buffer = std::array<std::byte, nBufferSize>;
68 bool resize(size_type nNewSize, size_type nAlignment, sbo_resize_type eSboResizeType,
bool bMemmove) noexcept;
79 std::byte*
data() noexcept;
85 const std::byte*
data()
const noexcept;
91 size_type
size()
const noexcept;
109 std::byte* m_pData =
nullptr;
112 size_type m_nSize = 0;
113 size_type m_nAllocatedSize = 0;
A type erased small buffer object that works with raw data.
size_type size() const noexcept
Get SBO size (bytes)
bool resize(size_type nNewSize, size_type nAlignment, sbo_resize_type eSboResizeType, bool bMemmove) noexcept
Resize SBO.
void free() noexcept
Free allocated memory.
size_type capacity() const noexcept
Get SBO capacity (bytes)
bool is_small() const noexcept
Is the SBO small and fits into the local buffer.
std::byte * data() noexcept
Get SBO data: from a buffer or from a heap.