Template Class basic_memory_buffer

Inheritance Relationships

Base Types

Class Documentation

template<typename T, std::size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
class basic_memory_buffer : private Allocator, public fmt::v6::internal::buffer<T>

A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE elements stored in the object itself.

You can use one of the following type aliases for common character types:

Type

Definition

memory_buffer

basic_memory_buffer<char>

wmemory_buffer

basic_memory_buffer<wchar_t>

Example*:

fmt::memory_buffer out;
format_to(out, "The answer is {}.", 42);

This will append the following output to the out object:

The answer is 42.

The output can be converted to an std::string with to_string(out).

Public Types

template<>
using value_type = T
template<>
using const_reference = const T&

Public Functions

basic_memory_buffer(const Allocator &alloc = Allocator())
~basic_memory_buffer()
basic_memory_buffer(basic_memory_buffer &&other)

Constructs a fmt::basic_memory_buffer object moving the content of the other object to it.

basic_memory_buffer &operator=(basic_memory_buffer &&other)

Moves the content of the other basic_memory_buffer object to this one.

Allocator get_allocator() const

Protected Functions

void grow(std::size_t capacity)

Increases the buffer capacity to hold at least capacity elements.