Skip to content

Commit 7e1ddc6

Browse files
committed
Make as_lvalue a bit more generic
1 parent ce896e5 commit 7e1ddc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/test_utils.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ constexpr void has_type(Actual &&)
130130
static_assert(std::is_same<Expected, Actual>::value, "Not the same");
131131
}
132132

133-
template<ranges::cardinality Expected,
134-
typename Rng,
133+
template<ranges::cardinality Expected,
134+
typename Rng,
135135
ranges::cardinality Actual = ranges::range_cardinality<Rng>::value>
136136
constexpr void has_cardinality(Rng &&)
137137
{
@@ -141,7 +141,7 @@ constexpr void has_cardinality(Rng &&)
141141
template<typename T>
142142
constexpr T & as_lvalue(T && t)
143143
{
144-
return *&t; // prevent C++23 implicit move
144+
return static_cast<T&>(t); // prevent C++23 implicit move (plain `t` is move-eligible)
145145
}
146146

147147
// A simple, light-weight, non-owning reference to a type-erased function.

0 commit comments

Comments
 (0)