Commit 81c7cf71 by Jonathan Wakely Committed by Jonathan Wakely

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
parent 73f1289e
2019-04-24 Jonathan Wakely <jwakely@redhat.com> 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) * include/experimental/string_view (basic_string_view::pointer)
(basic_string_view::reference): Fix to refer to non-const value_type. (basic_string_view::reference): Fix to refer to non-const value_type.
* include/bits/basic_string.h (basic_string): Use __sv_check and * include/bits/basic_string.h (basic_string): Use __sv_check and
......
...@@ -1674,7 +1674,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1674,7 +1674,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
{ } { }
#if __cplusplus > 201402L #if __cplusplus >= 201703L
# define __cpp_lib_apply 201603 # define __cpp_lib_apply 201603
template <typename _Fn, typename _Tuple, size_t... _Idx> template <typename _Fn, typename _Tuple, size_t... _Idx>
...@@ -1689,7 +1689,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1689,7 +1689,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr decltype(auto) constexpr decltype(auto)
apply(_Fn&& __f, _Tuple&& __t) 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), return std::__apply_impl(std::forward<_Fn>(__f),
std::forward<_Tuple>(__t), std::forward<_Tuple>(__t),
_Indices{}); _Indices{});
......
...@@ -2327,10 +2327,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2327,10 +2327,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Res, typename _Class, typename _Arg, typename... _Args> template<typename _Res, typename _Class, typename _Arg, typename... _Args>
struct __result_of_memfun<_Res _Class::*, _Arg, _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 _Res _Class::* _MemPtr;
typedef typename conditional<__or_<is_same<_Argval, _Class>, typedef typename conditional<is_base_of<_Class, _Argval>::value,
is_base_of<_Class, _Argval>>::value,
__result_of_memfun_ref<_MemPtr, _Arg, _Args...>, __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
__result_of_memfun_deref<_MemPtr, _Arg, _Args...> __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
>::type::type type; >::type::type type;
...@@ -2341,7 +2340,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -2341,7 +2340,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// as the object expression // as the object expression
// Used by result_of, invoke etc. to unwrap a reference_wrapper. // 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 struct __inv_unwrap
{ {
using type = _Tp; using type = _Tp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment