mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Optimize standard formatter specialization
This commit is contained in:
@ -2897,12 +2897,16 @@ struct formatter<T, Char,
|
|||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
|
FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
|
||||||
-> decltype(ctx.out()) {
|
-> decltype(ctx.out()) {
|
||||||
auto specs = specs_;
|
if (specs_.width_ref.kind != detail::arg_id_kind::none ||
|
||||||
detail::handle_dynamic_spec<detail::width_checker>(specs.width,
|
specs_.precision_ref.kind != detail::arg_id_kind::none) {
|
||||||
specs.width_ref, ctx);
|
auto specs = specs_;
|
||||||
detail::handle_dynamic_spec<detail::precision_checker>(
|
detail::handle_dynamic_spec<detail::width_checker>(specs.width,
|
||||||
specs.precision, specs.precision_ref, ctx);
|
specs.width_ref, ctx);
|
||||||
return detail::write<Char>(ctx.out(), val, specs, ctx.locale());
|
detail::handle_dynamic_spec<detail::precision_checker>(
|
||||||
|
specs.precision, specs.precision_ref, ctx);
|
||||||
|
return detail::write<Char>(ctx.out(), val, specs, ctx.locale());
|
||||||
|
}
|
||||||
|
return detail::write<Char>(ctx.out(), val, specs_, ctx.locale());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user