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.
Declared in <fmt/format.h>
template<
typename T,
size_t SIZE = inline_buffer_size,
typename Allocator = /* implementation-defined */>
class basic_memory_buffer
: public /* implementation-defined */
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).
| Name | Description |
|---|---|
/* implementation-defined */ | A contiguous memory buffer with an optional growing ability. It is an internal class and shouldn't be used directly, only via memory_buffer. |
| Name | Description |
|---|---|
const_reference | A const reference to an element stored in the buffer. |
value_type | The type of the elements stored in the buffer. |
| Name | Description |
|---|---|
basic_memory_buffer [constructor] | Constructors |
~basic_memory_buffer [destructor] | Destroys the buffer, deallocating any dynamically allocated storage. |
operator= | Moves the content of the other basic_memory_buffer object to this one. |
append | Appends the contents of range to the buffer. |
get_allocator | Returns a copy of the allocator associated with this buffer. |
reserve | Increases the buffer capacity to new_capacity. |
resize | Resizes the buffer to contain count elements. If T is a POD type new elements may not be initialized. |
| Name |
|---|
append |
| Name | Description |
|---|---|
to_string | Converts the contents of buf to a std::string. |