diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index c9f69d50..572aa407 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -350,29 +350,8 @@ template struct is_range { namespace detail { -template struct range_mapper { - using mapper = type_mapper; - using char_type = typename Context::char_type; - - template , char_type>>::value)> - static auto map(T&& value) -> T&& { - return static_cast(value); - } - template , char_type>>::value)> - static auto map(T&& value) -> decltype(mapper::map(static_cast(value))) { - return mapper::map(static_cast(value)); - } -}; - template -using range_formatter_type = - formatter>{} - .map(std::declval()))>, - Char>; +using range_formatter_type = formatter, Char>; template using maybe_const_range = @@ -485,7 +464,6 @@ struct range_formatter< template auto format(R&& range, FormatContext& ctx) const -> decltype(ctx.out()) { - auto mapper = detail::range_mapper>(); auto out = ctx.out(); auto it = detail::range_begin(range); auto end = detail::range_end(range); @@ -497,7 +475,7 @@ struct range_formatter< if (i > 0) out = detail::copy(separator_, out); ctx.advance_to(out); auto&& item = *it; // Need an lvalue - out = underlying_.format(mapper.map(item), ctx); + out = underlying_.format(item, ctx); ++i; } out = detail::copy(closing_bracket_, out); @@ -593,12 +571,11 @@ struct formatter< basic_string_view open = detail::string_literal{}; if (!no_delimiters_) out = detail::copy(open, out); int i = 0; - auto mapper = detail::range_mapper>(); basic_string_view sep = detail::string_literal{}; for (auto&& value : map) { if (i > 0) out = detail::copy(sep, out); ctx.advance_to(out); - detail::for_each2(formatters_, mapper.map(value), + detail::for_each2(formatters_, value, detail::format_tuple_element{ 0, ctx, detail::string_literal{}}); ++i;