mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-07 08:31:16 +00:00
Optimize common case
This commit is contained in:
parent
98d4bbf813
commit
1a716caf5d
@ -3181,6 +3181,11 @@ typename Context::iterator vformat_to(
|
|||||||
basic_format_args<Context> args,
|
basic_format_args<Context> args,
|
||||||
detail::locale_ref loc = detail::locale_ref()) {
|
detail::locale_ref loc = detail::locale_ref()) {
|
||||||
format_handler<ArgFormatter, Char, Context> h(out, format_str, args, loc);
|
format_handler<ArgFormatter, Char, Context> h(out, format_str, args, loc);
|
||||||
|
if (format_str.size() == 2 && format_str[0] == '{' && format_str[1] == '}') {
|
||||||
|
auto arg = detail::get_arg(h.context, 0);
|
||||||
|
h.parse_context.advance_to(&format_str[1]);
|
||||||
|
return visit_format_arg(ArgFormatter(h.context, &h.parse_context), arg);
|
||||||
|
}
|
||||||
detail::parse_format_string<false>(format_str, h);
|
detail::parse_format_string<false>(format_str, h);
|
||||||
return h.context.out();
|
return h.context.out();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user