Skip to content

Commit

Permalink
Cleanup an example
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Oct 5, 2024
1 parent c68c5fa commit 0253754
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,17 @@ allocator:
using custom_string =
std::basic_string<char, std::char_traits<char>, custom_allocator>;
custom_string vformat(custom_allocator alloc, fmt::string_view format_str,
fmt::format_args args) {
auto vformat(custom_allocator alloc, fmt::string_view fmt,
fmt::format_args args) -> custom_string {
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);
}
template <typename ...Args>
inline custom_string format(custom_allocator alloc,
fmt::string_view format_str,
const Args& ... args) {
return vformat(alloc, format_str, fmt::make_format_args(args...));
auto format(custom_allocator alloc, fmt::string_view fmt,
const Args& ... args) -> custom_string {
return vformat(alloc, fmt, fmt::make_format_args(args...));
}
The allocator will be used for the output container only. Formatting
Expand Down

0 comments on commit 0253754

Please sign in to comment.