diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index b4076c43bf3f..ee3b747c475c 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -646,9 +646,9 @@ struct formatter, Char> { #endif formatter, Char> value_formatter_; - using view_ref = conditional_t::value, - const join_view&, - join_view&&>; + using view = conditional_t::value, + const join_view, + join_view>; public: using nonlocking = void; @@ -658,9 +658,10 @@ struct formatter, Char> { } template - auto format(view_ref& value, FormatContext& ctx) const - -> decltype(ctx.out()) { - auto it = std::forward(value).begin; + auto format(view& value, FormatContext& ctx) const -> decltype(ctx.out()) { + using iter = + conditional_t::value, It, It&>; + iter it = value.begin; auto out = ctx.out(); if (it == value.end) return out; out = value_formatter_.format(*it, ctx);