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
21template <class _Tp>
22struct __unwrap_reference {
23  typedef _LIBCPP_NODEBUG _Tp type;
24};
25
26template <class _Tp>
27class reference_wrapper;
28
29template <class _Tp>
30struct __unwrap_reference<reference_wrapper<_Tp> > {
31  typedef _LIBCPP_NODEBUG _Tp& type;
32};
33
34template <class _Tp>
35struct decay;
36
37#if _LIBCPP_STD_VER >= 20
38template <class _Tp>
39struct unwrap_reference : __unwrap_reference<_Tp> {};
40
41template <class _Tp>
42using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
43
44template <class _Tp>
45struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {};
46
47template <class _Tp>
48using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
49#endif // _LIBCPP_STD_VER >= 20
50
51template <class _Tp>
52struct __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