mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Cleanup an example
This commit is contained in:
13
doc/api.md
13
doc/api.md
@ -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
|
||||||
|
Reference in New Issue
Block a user