|
FMT_CONSTEXPR20 | basic_memory_buffer (const Allocator &alloc=Allocator()) |
|
FMT_CONSTEXPR20 | basic_memory_buffer (basic_memory_buffer &&other) noexcept |
|
auto | operator= (basic_memory_buffer &&other) noexcept -> basic_memory_buffer & |
| Moves the content of the other basic_memory_buffer object to this one.
|
|
auto | get_allocator () const -> Allocator |
|
FMT_CONSTEXPR20 void | resize (size_t count) |
|
void | reserve (size_t new_capacity) |
| Increases the buffer capacity to new_capacity .
|
|
template<typename ContiguousRange> |
void | append (const ContiguousRange &range) |
|
| buffer (const buffer &)=delete |
|
void | operator= (const buffer &)=delete |
|
auto | begin () noexcept -> T * |
|
auto | end () noexcept -> T * |
|
auto | begin () const noexcept -> const T * |
|
auto | end () const noexcept -> const T * |
|
constexpr auto | size () const noexcept -> size_t |
| Returns the size of this buffer.
|
|
constexpr auto | capacity () const noexcept -> size_t |
| Returns the capacity of this buffer.
|
|
FMT_CONSTEXPR auto | data () noexcept -> T * |
| Returns a pointer to the buffer data (not null-terminated).
|
|
FMT_CONSTEXPR auto | data () const noexcept -> const T * |
|
void | clear () |
| Clears this buffer.
|
|
FMT_CONSTEXPR void | try_resize (size_t count) |
|
FMT_CONSTEXPR void | try_reserve (size_t new_capacity) |
|
FMT_CONSTEXPR void | push_back (const T &value) |
|
template<typename U> |
void | append (const U *begin, const U *end) |
| Appends data to the end of the buffer.
|
|
template<typename Idx> |
FMT_CONSTEXPR auto | operator[] (Idx index) -> T & |
|
template<typename Idx> |
FMT_CONSTEXPR auto | operator[] (Idx index) const -> const T & |
|
template<typename T, size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
class basic_memory_buffer< T, SIZE, Allocator >
A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE
elements stored in the object itself. Most commonly used via the memory_buffer
alias for char
.
Example:
auto out = fmt::memory_buffer();
fmt::format_to(std::back_inserter(out), "The answer is {}.", 42);
This will append "The answer is 42." to out
. The buffer content can be converted to std::string
with to_string(out)
.