xref: /llvm-project/libcxx/include/__type_traits/remove_reference.h (revision 6f684816e25d8b4e5fb2cbc7d0560d608a8bd938)
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_REMOVE_REFERENCE_H
10 #define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_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_BEGIN_NAMESPACE_STD
19 
20 #if __has_builtin(__remove_reference_t)
21 template <class _Tp>
22 struct _LIBCPP_NO_SPECIALIZATIONS remove_reference {
23   using type _LIBCPP_NODEBUG = __remove_reference_t(_Tp);
24 };
25 
26 template <class _Tp>
27 using __libcpp_remove_reference_t _LIBCPP_NODEBUG = __remove_reference_t(_Tp);
28 #elif __has_builtin(__remove_reference)
29 template <class _Tp>
30 struct remove_reference {
31   using type _LIBCPP_NODEBUG = __remove_reference(_Tp);
32 };
33 
34 template <class _Tp>
35 using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type;
36 #else
37 #  error "remove_reference not implemented!"
38 #endif // __has_builtin(__remove_reference_t)
39 
40 #if _LIBCPP_STD_VER >= 14
41 template <class _Tp>
42 using remove_reference_t = __libcpp_remove_reference_t<_Tp>;
43 #endif
44 
45 _LIBCPP_END_NAMESPACE_STD
46 
47 #endif // _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
48