diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index b4076c43bf3f..63d23aa25274 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -660,7 +660,9 @@ struct formatter, Char> { template auto format(view_ref& value, FormatContext& ctx) const -> decltype(ctx.out()) { - auto it = std::forward(value).begin; + 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);