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 #if __has_builtin(__add_pointer) 25 template <class _Tp> 26 struct add_pointer { 27 using type _LIBCPP_NODEBUG = __add_pointer(_Tp); 28 }; 29 #else 30 template <class _Tp, 31 bool = __libcpp_is_referenceable<_Tp>::value || _IsSame<typename remove_cv<_Tp>::type, void>::value> 32 struct __add_pointer_impl { 33 typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type; 34 }; 35 template <class _Tp> struct __add_pointer_impl<_Tp, false> 36 {typedef _LIBCPP_NODEBUG _Tp type;}; 37 38 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer 39 {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;}; 40 #endif // __has_builtin(__add_pointer) 41 42 #if _LIBCPP_STD_VER > 11 43 template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 44 #endif 45 46 _LIBCPP_END_NAMESPACE_STD 47 48 #endif // _LIBCPP___TYPE_TRAITS_ADD_POINTER_H 49