From 104178c3912314f41a61a316e7c3bc0487ea8f3c Mon Sep 17 00:00:00 2001 From: K1ZeKaTo Date: Sat, 5 Aug 2023 14:50:19 +0000 Subject: [PATCH] Make the rvalue work fine. It seems not considering the rvalue in the last version. --- libstdc++-v3/include/bits/iterator_concepts.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h index e32e94dc9fc..8bb7c0fb8c0 100644 --- a/libstdc++-v3/include/bits/iterator_concepts.h +++ b/libstdc++-v3/include/bits/iterator_concepts.h @@ -86,14 +86,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION concept __can_reference = requires { typename __with_ref<_Tp>; }; template - concept __dereferenceable = requires(_Tp& __t) + concept __dereferenceable = requires(_Tp&& __t) { - { *__t } -> __can_reference; + { *static_cast<_Tp&&>(__t) } -> __can_reference; }; } // namespace __detail template<__detail::__dereferenceable _Tp> - using iter_reference_t = decltype(*std::declval<_Tp&>()); + using iter_reference_t = decltype(*std::declval<_Tp&&>()); namespace ranges { @@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template requires __adl_imove<_Tp> struct __result<_Tp> - { using type = decltype(iter_move(std::declval<_Tp>())); }; + { using type = decltype(iter_move(std::declval<_Tp&&>())); }; template requires (!__adl_imove<_Tp>) @@ -129,9 +129,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _S_noexcept() { if constexpr (__adl_imove<_Tp>) - return noexcept(iter_move(std::declval<_Tp>())); + return noexcept(iter_move(std::declval<_Tp&&>())); else - return noexcept(*std::declval<_Tp>()); + return noexcept(*std::declval<_Tp&&>()); } public: @@ -148,9 +148,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if constexpr (__adl_imove<_Tp>) return iter_move(static_cast<_Tp&&>(__e)); else if constexpr (is_lvalue_reference_v>) - return static_cast<__type<_Tp>>(*__e); + return static_cast<__type<_Tp>>(*static_cast<_Tp&&>(__e)); else - return *__e; + return *static_cast<_Tp&&>(__e); } }; } // namespace __cust_imove -- 2.41.0