Template Class dynamic_format_arg_store

Class Documentation

template<typename Context>
class fmt::v6::dynamic_format_arg_store

A dynamic version of fmt::format_arg_store<>. It’s equipped with a storage to potentially temporary objects which lifetime could be shorter than the format arguments object.

It can be implicitly converted into ~fmt::basic_format_args for passing into type-erased formatting functions such as ~fmt::vformat.

Public Functions

template<typename T>
void push_back(const T &arg)

Adds an argument into the dynamic store for later passing to a formating function.

Note that custom types and string types (but not string views!) are copied into the store with dynamic memory (in addition to resizing vector).

Example*:

fmt::dynamic_format_arg_store<fmt::format_context> store;
store.push_back(42);
store.push_back("abc");
store.push_back(1.5f);
std::string result = fmt::vformat("{} and {} and {}", store);

template<typename T>
void push_back(std::reference_wrapper<T> arg)

Adds a reference to the argument into the dynamic store for later passing to a formating function.