xref: /openbsd-src/gnu/llvm/libcxx/include/__functional/unwrap_ref.h (revision a0747c9f67a4ae71ccb71e62a28d1ea19e06a63c)
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___FUNCTIONAL_UNWRAP_REF_H
10 #define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H
11 
12 #include <__config>
13 
14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15 #pragma GCC system_header
16 #endif
17 
18 _LIBCPP_PUSH_MACROS
19 #include <__undef_macros>
20 
21 _LIBCPP_BEGIN_NAMESPACE_STD
22 
23 template <class _Tp>
24 struct __unwrap_reference { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
25 
26 template <class _Tp>
27 class reference_wrapper;
28 
29 template <class _Tp>
30 struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
31 
32 template <class _Tp>
33 struct decay;
34 
35 #if _LIBCPP_STD_VER > 17
36 template <class _Tp>
37 struct unwrap_reference : __unwrap_reference<_Tp> { };
38 
39 template <class _Tp>
40 using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
41 
42 template <class _Tp>
43 struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { };
44 
45 template <class _Tp>
46 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
47 #endif // > C++17
48 
49 template <class _Tp>
50 struct __unwrap_ref_decay
51 #if _LIBCPP_STD_VER > 17
52     : unwrap_ref_decay<_Tp>
53 #else
54     : __unwrap_reference<typename decay<_Tp>::type>
55 #endif
56 { };
57 
58 _LIBCPP_END_NAMESPACE_STD
59 
60 _LIBCPP_POP_MACROS
61 
62 #endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H
63