Cleanup an example

This commit is contained in:
Victor Zverovich
2024-10-04 17:15:07 -07:00
parent c68c5fa7c7
commit 02537548f3

View File

@ -375,18 +375,17 @@ allocator:
using custom_string = using custom_string =
std::basic_string<char, std::char_traits<char>, custom_allocator>; std::basic_string<char, std::char_traits<char>, custom_allocator>;
custom_string vformat(custom_allocator alloc, fmt::string_view format_str, auto vformat(custom_allocator alloc, fmt::string_view fmt,
fmt::format_args args) { fmt::format_args args) -> custom_string {
auto buf = custom_memory_buffer(alloc); auto buf = custom_memory_buffer(alloc);
fmt::vformat_to(std::back_inserter(buf), format_str, args); fmt::vformat_to(std::back_inserter(buf), fmt, args);
return custom_string(buf.data(), buf.size(), alloc); return custom_string(buf.data(), buf.size(), alloc);
} }
template <typename ...Args> template <typename ...Args>
inline custom_string format(custom_allocator alloc, auto format(custom_allocator alloc, fmt::string_view fmt,
fmt::string_view format_str, const Args& ... args) -> custom_string {
const Args& ... args) { return vformat(alloc, fmt, fmt::make_format_args(args...));
return vformat(alloc, format_str, fmt::make_format_args(args...));
} }
The allocator will be used for the output container only. Formatting The allocator will be used for the output container only. Formatting