Warning: This file is not a C or C++ file. It does not have highlighting.

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

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of libcxx/include/__type_traits/add_pointer.h