[libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference

Summary:
This was voted into C++20 in San Diego. Note that there was a revision
D0318R2 which did include unwrap_reference_t, but we mistakingly voted
P0318R1 into the C++20 Working Draft (which does not include
unwrap_reference_t). This patch implements D0318R2, which is what
we'll end up with in the Working Draft once this mistake has been
fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D54485

llvm-svn: 348138
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: bb9ca6d0bfc2d2111025d8e342279163458a8639
diff --git a/include/tuple b/include/tuple
index 766f2e3..2e54a5f 100644
--- a/include/tuple
+++ b/include/tuple
@@ -1078,30 +1078,12 @@
   _LIBCPP_INLINE_VAR constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
 }
 
-template <class _Tp>
-struct __make_tuple_return_impl
-{
-    typedef _Tp type;
-};
-
-template <class _Tp>
-struct __make_tuple_return_impl<reference_wrapper<_Tp> >
-{
-    typedef _Tp& type;
-};
-
-template <class _Tp>
-struct __make_tuple_return
-{
-    typedef typename __make_tuple_return_impl<typename decay<_Tp>::type>::type type;
-};
-
 template <class... _Tp>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-tuple<typename __make_tuple_return<_Tp>::type...>
+tuple<typename __unwrap_ref_decay<_Tp>::type...>
 make_tuple(_Tp&&... __t)
 {
-    return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
+    return tuple<typename __unwrap_ref_decay<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
 }
 
 template <class... _Tp>