|
qxLib
|
A type erased small buffer object that works with raw data. More...
#include <sbo_bytes.h>
Public Member Functions | |
| bool | resize (size_type nRequestedSize) noexcept |
| Make sure the capacity is at least nRequestedSize and allocate memory if needed, and change the size to nRequestedSize. More... | |
| bool | reserve (size_type nRequestedSize) noexcept |
| Make sure the capacity is at least nRequestedSize and allocate memory if needed, but do not change the size. More... | |
| bool | shrink_to_fit () noexcept |
| Reduce capacity to fit the size, possibly moving data to the internal buffer if the size becomes small. More... | |
| void | free () noexcept |
| Free allocated memory. | |
| QX_FORCE_INLINE std::byte * | data () noexcept |
| Get SBO data: from a buffer or from a heap. More... | |
| QX_FORCE_INLINE const std::byte * | data () const noexcept |
| Get SBO data: from a buffer or from a heap. More... | |
| QX_FORCE_INLINE size_type | size () const noexcept |
| Get SBO size (bytes) More... | |
| QX_FORCE_INLINE size_type | capacity () const noexcept |
| Get SBO capacity (bytes) More... | |
| QX_FORCE_INLINE bool | is_small () const noexcept |
| Is the SBO small and fits into the local buffer. More... | |
A type erased small buffer object that works with raw data.
| traits_t | - SBO traits type |
Definition at line 29 of file sbo_bytes.h.
|
noexcept |
Get SBO capacity (bytes)
| - | SBO capacity (bytes), can't be less than nBufferSize |
Definition at line 118 of file sbo_bytes.inl.
|
noexcept |
Get SBO data: from a buffer or from a heap.
| - | SBO data pointer |
Definition at line 106 of file sbo_bytes.inl.
|
noexcept |
Get SBO data: from a buffer or from a heap.
| - | SBO data pointer |
Definition at line 97 of file sbo_bytes.inl.
|
noexcept |
Is the SBO small and fits into the local buffer.
| - | true if the SBO is small and fits into the local buffer |
Definition at line 124 of file sbo_bytes.inl.
|
noexcept |
Make sure the capacity is at least nRequestedSize and allocate memory if needed, but do not change the size.
| nRequestedSize | - required size (bytes) |
| - | false if memory allocation failed, true otherwise |
Definition at line 60 of file sbo_bytes.inl.
|
noexcept |
Make sure the capacity is at least nRequestedSize and allocate memory if needed, and change the size to nRequestedSize.
| nRequestedSize | - required size (bytes) |
| - | false if memory allocation failed, true otherwise |
Definition at line 39 of file sbo_bytes.inl.
|
noexcept |
Reduce capacity to fit the size, possibly moving data to the internal buffer if the size becomes small.
| - | false if memory allocation failed, SBO remains valid in this case, true otherwise |
Definition at line 69 of file sbo_bytes.inl.
|
noexcept |