1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
10 #define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
11 
12 #include <__config>
13 #include <__type_traits/decay.h>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #  pragma GCC system_header
17 #endif
18 
19 _LIBCPP_BEGIN_NAMESPACE_STD
20 
21 template <class _Tp>
22 struct __unwrap_reference {
23   typedef _LIBCPP_NODEBUG _Tp type;
24 };
25 
26 template <class _Tp>
27 class reference_wrapper;
28 
29 template <class _Tp>
30 struct __unwrap_reference<reference_wrapper<_Tp> > {
31   typedef _LIBCPP_NODEBUG _Tp& type;
32 };
33 
34 template <class _Tp>
35 struct decay;
36 
37 #if _LIBCPP_STD_VER >= 20
38 template <class _Tp>
39 struct unwrap_reference : __unwrap_reference<_Tp> {};
40 
41 template <class _Tp>
42 using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
43 
44 template <class _Tp>
45 struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {};
46 
47 template <class _Tp>
48 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
49 #endif // _LIBCPP_STD_VER >= 20
50 
51 template <class _Tp>
52 struct __unwrap_ref_decay
53 #if _LIBCPP_STD_VER >= 20
54     : unwrap_ref_decay<_Tp>
55 #else
56     : __unwrap_reference<__decay_t<_Tp> >
57 #endif
58 {
59 };
60 
61 _LIBCPP_END_NAMESPACE_STD
62 
63 #endif // _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
64