Skip to content

Commit a4f3347

Browse files
committed
Remove unnecessary forwarding
* ra/ply.hh (ply_fixed, for_each, early): Expressions get consumed here, so there's no reason to forward.
1 parent c6d2a1b commit a4f3347

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

ra/ply.hh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ ply_ravel(A && a, Early && early = Nop {})
9595

9696
// compile time order/rank.
9797

98-
template <auto order, int k, int urank, class A, class S, class Early>
98+
template <auto order, int k, int urank, class S, class Early>
9999
constexpr auto
100-
subply(A & a, dim_t s, S const & ss0, Early & early)
100+
subply(Iterator auto & a, dim_t s, S const & ss0, Early & early)
101101
{
102102
if constexpr (k < urank) {
103103
auto place = a.save();
@@ -132,9 +132,9 @@ subply(A & a, dim_t s, S const & ss0, Early & early)
132132
}
133133
}
134134

135-
template <Iterator A, class Early = Nop>
135+
template <class Early = Nop>
136136
constexpr decltype(auto)
137-
ply_fixed(A && a, Early && early = Nop {})
137+
ply_fixed(Iterator auto && a, Early && early = Nop {})
138138
{
139139
validate(a);
140140
constexpr rank_t rank = rank_s(a);
@@ -162,25 +162,21 @@ ply_fixed(A && a, Early && early = Nop {})
162162

163163
// defaults.
164164

165-
template <Iterator A, class Early = Nop>
165+
template <class Early = Nop>
166166
constexpr decltype(auto)
167-
ply(A && a, Early && early = Nop {})
167+
ply(Iterator auto && a, Early && early = Nop {})
168168
{
169169
if constexpr (ANY==size_s(a)) {
170-
return ply_ravel(RA_FW(a), RA_FW(early));
170+
return ply_ravel(a, early);
171171
} else {
172-
return ply_fixed(RA_FW(a), RA_FW(early));
172+
return ply_fixed(a, early);
173173
}
174174
}
175175

176-
constexpr void
177-
for_each(auto && op, auto && ... a) { ply(map(RA_FW(op), RA_FW(a) ...)); }
176+
constexpr void for_each(auto && op, auto && ... a) { ply(map(op, a ...)); }
178177

179-
template <class T> struct Default { T def; };
180-
template <class T> Default(T &&) -> Default<T>;
181-
182-
constexpr decltype(auto)
183-
early(Iterator auto && a, auto && def) { return ply(RA_FW(a), Default { RA_FW(def) }); }
178+
template <class T> struct Default { T & def; };
179+
constexpr decltype(auto) early(Iterator auto && a, auto && def) { return ply(a, Default { def }); }
184180

185181

186182
// --------------------

0 commit comments

Comments
 (0)