mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-06 23:30:29 +00:00
Printf get container (#1982)
* eliminate one case where basic_print_context would copy a string into a fmt::basic_memory_buffer character by character instead of using fmt::basic_memory_buffer::append * use detail::write instead of re-implementing it * use to_unsigned to avoid signedness conversion warnings
This commit is contained in:
parent
7abc3c01e0
commit
986fa00406
@ -480,11 +480,13 @@ OutputIt basic_printf_context<OutputIt, Char>::format() {
|
|||||||
}
|
}
|
||||||
char_type c = *it++;
|
char_type c = *it++;
|
||||||
if (it != end && *it == c) {
|
if (it != end && *it == c) {
|
||||||
out = std::copy(start, it, out);
|
out = detail::write(
|
||||||
|
out, basic_string_view<Char>(start, detail::to_unsigned(it - start)));
|
||||||
start = ++it;
|
start = ++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
out = std::copy(start, it - 1, out);
|
out = detail::write(out, basic_string_view<Char>(
|
||||||
|
start, detail::to_unsigned(it - 1 - start)));
|
||||||
|
|
||||||
format_specs specs;
|
format_specs specs;
|
||||||
specs.align = align::right;
|
specs.align = align::right;
|
||||||
@ -596,7 +598,8 @@ OutputIt basic_printf_context<OutputIt, Char>::format() {
|
|||||||
// Format argument.
|
// Format argument.
|
||||||
out = visit_format_arg(ArgFormatter(out, specs, *this), arg);
|
out = visit_format_arg(ArgFormatter(out, specs, *this), arg);
|
||||||
}
|
}
|
||||||
return std::copy(start, it, out);
|
return detail::write(
|
||||||
|
out, basic_string_view<Char>(start, detail::to_unsigned(it - start)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
|
Loading…
Reference in New Issue
Block a user