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_ADD_POINTER_H
10 #define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H
11 
12 #include <__config>
13 #include <__type_traits/is_referenceable.h>
14 #include <__type_traits/is_same.h>
15 #include <__type_traits/remove_cv.h>
16 #include <__type_traits/remove_reference.h>
17 
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 #  pragma GCC system_header
20 #endif
21 
22 _LIBCPP_BEGIN_NAMESPACE_STD
23 
24 template <class _Tp,
25         bool = __is_referenceable<_Tp>::value ||
26                 _IsSame<typename remove_cv<_Tp>::type, void>::value>
27 struct __add_pointer_impl
28     {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;};
29 template <class _Tp> struct __add_pointer_impl<_Tp, false>
30     {typedef _LIBCPP_NODEBUG _Tp type;};
31 
32 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
33     {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;};
34 
35 #if _LIBCPP_STD_VER > 11
36 template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
37 #endif
38 
39 _LIBCPP_END_NAMESPACE_STD
40 
41 #endif // _LIBCPP___TYPE_TRAITS_ADD_POINTER_H
42