diff --git a/doc/api.rst b/doc/api.rst index e295f171..383e8977 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -350,8 +350,8 @@ allocator:: custom_string vformat(custom_allocator alloc, fmt::string_view format_str, fmt::format_args args) { - custom_memory_buffer buf(alloc); - fmt::vformat_to(buf, format_str, args); + auto buf = custom_memory_buffer(alloc); + fmt::vformat_to(std::back_inserter(buf), format_str, args); return custom_string(buf.data(), buf.size(), alloc); } diff --git a/include/fmt/format.h b/include/fmt/format.h index ebcd1cc2..b94d2adf 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -607,8 +607,8 @@ enum { inline_buffer_size = 500 }; **Example**:: - fmt::memory_buffer out; - format_to(out, "The answer is {}.", 42); + auto out = fmt::memory_buffer(); + format_to(std::back_inserter(out), "The answer is {}.", 42); This will append the following output to the ``out`` object: