diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 1f4da818..37157188 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -144,32 +144,33 @@ void for_each(Tuple &&tup, F &&f) { // ===================================================================================================================== template struct formatter>> { - fmt::formatting_tuple formating; + + fmt::formatting_tuple formatting; template FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { - return formating.parse(ctx); + return formatting.parse(ctx); } template auto format(const TupleT &values, FormatContext &ctx) -> decltype(ctx.out()) { auto out = ctx.out(); std::size_t i = 0; - internal::copy(formating.prefix, out); + internal::copy(formatting.prefix, out); internal::for_each(values, [&](const auto &v) { if (i++ > 0) { - internal::copy(formating.delimiter, out); + internal::copy(formatting.delimiter, out); } - if (formating.add_spaces) { + if (formatting.add_spaces) { format_to(out, " {}", v); } else { format_to(out, "{}", v); } }); - if (formating.add_spaces) { + if (formatting.add_spaces) { *out++ = ' '; } - internal::copy(formating.postfix, out); + internal::copy(formatting.postfix, out); return ctx.out(); } @@ -177,26 +178,27 @@ struct formatter struct formatter>> { + static FMT_CONSTEXPR std::size_t range_length_limit = FMT_RANGE_OUTPUT_LENGTH_LIMIT; // output only up to N items from the range. - fmt::formatting_range formating; + fmt::formatting_range formatting; template FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { - return formating.parse(ctx); + return formatting.parse(ctx); } template auto format(const RangeT &values, FormatContext &ctx) -> decltype(ctx.out()) { auto out = ctx.out(); - internal::copy(formating.prefix, out); + internal::copy(formatting.prefix, out); std::size_t i = 0; for (const auto &it : values) { if (i > 0) { - internal::copy(formating.delimiter, out); + internal::copy(formatting.delimiter, out); } - if (formating.add_spaces) { + if (formatting.add_spaces) { format_to(out, " {}", it); } else { format_to(out, "{}", it); @@ -206,10 +208,10 @@ struct formatter