Finish implementing "Treating Unnecessary decay" (P0777R1)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 24 Apr 2019 16:25:17 +0000 (17:25 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 24 Apr 2019 16:25:17 +0000 (17:25 +0100)
* 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
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/type_traits

index 5e8a09a66364ba090106bc7f32c1b180ccd47db5..913c8ebf66ce25d8453afe842eb1b02e30405a39 100644 (file)
@@ -1,5 +1,11 @@
 2019-04-24  Jonathan Wakely  <jwakely@redhat.com>
 
+       * 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
index 0adef1ab384a35a26953decb03042d747b072ae1..6c7d91b7987554dcddfd921979a8f4eb4640e6cc 100644 (file)
@@ -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 <typename _Fn, typename _Tuple, size_t... _Idx>
@@ -1689,7 +1689,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr decltype(auto)
     apply(_Fn&& __f, _Tuple&& __t)
     {
-      using _Indices = make_index_sequence<tuple_size_v<decay_t<_Tuple>>>;
+      using _Indices
+       = make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>;
       return std::__apply_impl(std::forward<_Fn>(__f),
                               std::forward<_Tuple>(__t),
                               _Indices{});
index e0ac5c88dfc3fd13bbfab79829cec9e94252201d..1d14c751cfac79a48d70c31952c5d4ae39897cca 100644 (file)
@@ -2327,10 +2327,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Res, typename _Class, typename _Arg, typename... _Args>
     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_same<_Argval, _Class>,
-        is_base_of<_Class, _Argval>>::value,
+      typedef typename conditional<is_base_of<_Class, _Argval>::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<typename _Tp, typename _Up = typename decay<_Tp>::type>
+  template<typename _Tp, typename _Up = __remove_cvref_t<_Tp>>
     struct __inv_unwrap
     {
       using type = _Tp;