Skip to content

Commit 9ced61b

Browse files
authored
Replace std::forward for clang-tidy (#4236)
Should fix #4231
1 parent 75e5be6 commit 9ced61b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/fmt/ranges.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,9 @@ struct formatter<join_view<It, Sentinel, Char>, Char> {
646646
#endif
647647
formatter<remove_cvref_t<value_type>, Char> value_formatter_;
648648

649-
using view_ref = conditional_t<std::is_copy_constructible<It>::value,
650-
const join_view<It, Sentinel, Char>&,
651-
join_view<It, Sentinel, Char>&&>;
649+
using view = conditional_t<std::is_copy_constructible<It>::value,
650+
const join_view<It, Sentinel, Char>,
651+
join_view<It, Sentinel, Char>>;
652652

653653
public:
654654
using nonlocking = void;
@@ -658,9 +658,10 @@ struct formatter<join_view<It, Sentinel, Char>, Char> {
658658
}
659659

660660
template <typename FormatContext>
661-
auto format(view_ref& value, FormatContext& ctx) const
662-
-> decltype(ctx.out()) {
663-
auto it = std::forward<view_ref>(value).begin;
661+
auto format(view& value, FormatContext& ctx) const -> decltype(ctx.out()) {
662+
using iter =
663+
conditional_t<std::is_copy_constructible<view>::value, It, It&>;
664+
iter it = value.begin;
664665
auto out = ctx.out();
665666
if (it == value.end) return out;
666667
out = value_formatter_.format(*it, ctx);

0 commit comments

Comments
 (0)