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
This commit is contained in:
Jonathan Wakely 2019-04-24 17:25:17 +01:00 committed by Jonathan Wakely
parent 73f1289e49
commit 81c7cf71bf
3 changed files with 12 additions and 6 deletions

View 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

View 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{});

View 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;