fix(range): fix DeclVal() usage in range library

This commit is contained in:
Redstone1024 2024-12-17 14:46:03 +08:00
parent 312cfe4097
commit 00be872d5c
3 changed files with 5 additions and 5 deletions

View File

@ -152,7 +152,7 @@ NODISCARD FORCEINLINE constexpr auto All(R&& InRange)
/** Creates A view adapter that includes all elements of a range. */
NODISCARD FORCEINLINE constexpr auto All()
{
return TAdaptorClosure([]<CViewableRange R> requires (requires { All(DeclVal<R&&>()); }) (R && Base)
return TAdaptorClosure([]<CViewableRange R> requires (requires { All(DeclVal<R>()); }) (R&& Base)
{
return All(Forward<R>(Base));
});

View File

@ -165,7 +165,7 @@ NAMESPACE_END(Range)
NAMESPACE_BEGIN(Range)
/** Creates A view adapter that consists of the elements of a range that satisfies a predicate. */
template <CViewableRange R, typename Pred> requires (requires { TFilterView(DeclVal<R&&>(), DeclVal<Pred&&>()); })
template <CViewableRange R, typename Pred> requires (requires { TFilterView(DeclVal<R>(), DeclVal<Pred>()); })
NODISCARD FORCEINLINE constexpr auto Filter(R&& Base, Pred&& Predicate)
{
return TFilterView(Forward<R>(Base), Forward<Pred>(Predicate));
@ -175,7 +175,7 @@ NODISCARD FORCEINLINE constexpr auto Filter(R&& Base, Pred&& Predicate)
template <typename Pred>
NODISCARD FORCEINLINE constexpr auto Filter(Pred&& Predicate)
{
return TAdaptorClosure([&Predicate]<CViewableRange R> requires (requires { Range::Filter(DeclVal<R&&>(), DeclVal<Pred&&>()); }) (R&& Base)
return TAdaptorClosure([&Predicate]<CViewableRange R> requires (requires { Range::Filter(DeclVal<R>(), DeclVal<Pred>()); }) (R&& Base)
{
return Range::Filter(Forward<R>(Base), Forward<Pred>(Predicate));
});

View File

@ -212,7 +212,7 @@ NAMESPACE_END(Range)
NAMESPACE_BEGIN(Range)
/** Creates A view adapter of a sequence that applies a transformation function to each element. */
template <CViewableRange R, typename F> requires (requires { TTransformView(DeclVal<R&&>(), DeclVal<F&&>()); })
template <CViewableRange R, typename F> requires (requires { TTransformView(DeclVal<R>(), DeclVal<F>()); })
NODISCARD FORCEINLINE constexpr auto Transform(R&& Base, F&& Func)
{
return TTransformView(Forward<R>(Base), Forward<F>(Func));
@ -222,7 +222,7 @@ NODISCARD FORCEINLINE constexpr auto Transform(R&& Base, F&& Func)
template <typename F>
NODISCARD FORCEINLINE constexpr auto Transform(F&& Func)
{
return TAdaptorClosure([&Func]<CViewableRange R> requires (requires { Range::Transform(DeclVal<R&&>(), DeclVal<F&&>()); }) (R&& Base)
return TAdaptorClosure([&Func]<CViewableRange R> requires (requires { Range::Transform(DeclVal<R>(), DeclVal<F>()); }) (R&& Base)
{
return Range::Transform(Forward<R>(Base), Forward<F>(Func));
});