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/is_void.h> 16 #include <__type_traits/remove_cv.h> 17 #include <__type_traits/remove_reference.h> 18 19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 20 # pragma GCC system_header 21 #endif 22 23 _LIBCPP_BEGIN_NAMESPACE_STD 24 25 #if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) 26 27 template <class _Tp> 28 using __add_pointer_t = __add_pointer(_Tp); 29 30 #else 31 template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value || is_void<_Tp>::value> 32 struct __add_pointer_impl { 33 typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp>* type; 34 }; 35 template <class _Tp> 36 struct __add_pointer_impl<_Tp, false> { 37 typedef _LIBCPP_NODEBUG _Tp type; 38 }; 39 40 template <class _Tp> 41 using __add_pointer_t = typename __add_pointer_impl<_Tp>::type; 42 43 #endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) 44 45 template <class _Tp> 46 struct add_pointer { 47 using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>; 48 }; 49 50 #if _LIBCPP_STD_VER >= 14 51 template <class _Tp> 52 using add_pointer_t = __add_pointer_t<_Tp>; 53 #endif 54 55 _LIBCPP_END_NAMESPACE_STD 56 57 #endif // _LIBCPP___TYPE_TRAITS_ADD_POINTER_H 58