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_DECAY_H |
| 10 | #define _LIBCPP___TYPE_TRAITS_DECAY_H |
| 11 | |
| 12 | #include <__config> |
| 13 | #include <__type_traits/add_pointer.h> |
| 14 | #include <__type_traits/conditional.h> |
| 15 | #include <__type_traits/is_array.h> |
| 16 | #include <__type_traits/is_function.h> |
| 17 | #include <__type_traits/is_referenceable.h> |
| 18 | #include <__type_traits/remove_cv.h> |
| 19 | #include <__type_traits/remove_extent.h> |
| 20 | #include <__type_traits/remove_reference.h> |
| 21 | |
| 22 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 23 | # pragma GCC system_header |
| 24 | #endif |
| 25 | |
| 26 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 27 | |
| 28 | #if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC) |
| 29 | template <class _Tp> |
| 30 | using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); |
| 31 | |
| 32 | template <class _Tp> |
| 33 | struct _LIBCPP_NO_SPECIALIZATIONS decay { |
| 34 | using type _LIBCPP_NODEBUG = __decay_t<_Tp>; |
| 35 | }; |
| 36 | |
| 37 | #else |
| 38 | template <class _Up, bool> |
| 39 | struct __decay { |
| 40 | using type _LIBCPP_NODEBUG = __remove_cv_t<_Up>; |
| 41 | }; |
| 42 | |
| 43 | template <class _Up> |
| 44 | struct __decay<_Up, true> { |
| 45 | public: |
| 46 | using type _LIBCPP_NODEBUG = |
| 47 | __conditional_t<is_array<_Up>::value, |
| 48 | __add_pointer_t<__remove_extent_t<_Up> >, |
| 49 | __conditional_t<is_function<_Up>::value, typename add_pointer<_Up>::type, __remove_cv_t<_Up> > >; |
| 50 | }; |
| 51 | |
| 52 | template <class _Tp> |
| 53 | struct decay { |
| 54 | private: |
| 55 | using _Up _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tp>; |
| 56 | |
| 57 | public: |
| 58 | using type _LIBCPP_NODEBUG = typename __decay<_Up, __is_referenceable_v<_Up> >::type; |
| 59 | }; |
| 60 | |
| 61 | template <class _Tp> |
| 62 | using __decay_t = typename decay<_Tp>::type; |
| 63 | #endif // __has_builtin(__decay) |
| 64 | |
| 65 | #if _LIBCPP_STD_VER >= 14 |
| 66 | template <class _Tp> |
| 67 | using decay_t = __decay_t<_Tp>; |
| 68 | #endif |
| 69 | |
| 70 | _LIBCPP_END_NAMESPACE_STD |
| 71 | |
| 72 | #endif // _LIBCPP___TYPE_TRAITS_DECAY_H |
| 73 |
Warning: This file is not a C or C++ file. It does not have highlighting.
