|
10 | 10 | #define _LIBCPP___TYPE_TRAITS_DECAY_H |
11 | 11 |
|
12 | 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 | 13 |
|
22 | 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
23 | 15 | # pragma GCC system_header |
24 | 16 | #endif |
25 | 17 |
|
26 | 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
27 | 19 |
|
28 | | -#if __has_builtin(__decay) && !defined(_LIBCPP_COMPILER_GCC) |
29 | | -template <class _Tp> |
30 | | -using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); |
31 | | - |
32 | 20 | template <class _Tp> |
33 | 21 | 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> > >; |
| 22 | + using type _LIBCPP_NODEBUG = __decay(_Tp); |
50 | 23 | }; |
51 | 24 |
|
| 25 | +#ifdef _LIBCPP_COMPILER_GCC |
52 | 26 | 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 | | - |
| 27 | +using __decay_t _LIBCPP_NODEBUG = typename decay<_Tp>::type; |
| 28 | +#else |
61 | 29 | template <class _Tp> |
62 | | -using __decay_t = typename decay<_Tp>::type; |
63 | | -#endif // __has_builtin(__decay) |
| 30 | +using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); |
| 31 | +#endif |
64 | 32 |
|
65 | 33 | #if _LIBCPP_STD_VER >= 14 |
66 | 34 | template <class _Tp> |
|
0 commit comments