From 81c7cf71bf7bc76e360901edb4b3ccbecd2492d0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 24 Apr 2019 17:25:17 +0100 Subject: [PATCH] Finish implementing "Treating Unnecessary decay" (P0777R1) * include/std/tuple (apply): Use remove_reference_t instead of decay_t as per P0777R1. * include/std/type_traits (__result_of_memfun): Use remove_reference instead of __remove_cvref_t and remove redundant is_same check. (__inv_unwrap): Use __remove_cvref_t instead of decay_t. From-SVN: r270551 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/std/tuple | 5 +++-- libstdc++-v3/include/std/type_traits | 7 +++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5e8a09a6636..913c8ebf66c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2019-04-24 Jonathan Wakely + * include/std/tuple (apply): Use remove_reference_t instead of decay_t + as per P0777R1. + * include/std/type_traits (__result_of_memfun): Use remove_reference + instead of __remove_cvref_t and remove redundant is_same check. + (__inv_unwrap): Use __remove_cvref_t instead of decay_t. + * include/experimental/string_view (basic_string_view::pointer) (basic_string_view::reference): Fix to refer to non-const value_type. * include/bits/basic_string.h (basic_string): Use __sv_check and diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 0adef1ab384..6c7d91b7987 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1674,7 +1674,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) { } -#if __cplusplus > 201402L +#if __cplusplus >= 201703L # define __cpp_lib_apply 201603 template @@ -1689,7 +1689,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t) { - using _Indices = make_index_sequence>>; + using _Indices + = make_index_sequence>>; return std::__apply_impl(std::forward<_Fn>(__f), std::forward<_Tuple>(__t), _Indices{}); diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index e0ac5c88dfc..1d14c751cfa 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2327,10 +2327,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> { - typedef __remove_cvref_t<_Arg> _Argval; + typedef typename remove_reference<_Arg>::type _Argval; typedef _Res _Class::* _MemPtr; - typedef typename conditional<__or_, - is_base_of<_Class, _Argval>>::value, + typedef typename conditional::value, __result_of_memfun_ref<_MemPtr, _Arg, _Args...>, __result_of_memfun_deref<_MemPtr, _Arg, _Args...> >::type::type type; @@ -2341,7 +2340,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // as the object expression // Used by result_of, invoke etc. to unwrap a reference_wrapper. - template::type> + template> struct __inv_unwrap { using type = _Tp; -- 2.30.2