|
10 | 10 | #define _LIBCPP___TYPE_TRAITS_APPLY_CV_H
|
11 | 11 |
|
12 | 12 | #include <__config>
|
13 |
| -#include <__type_traits/is_const.h> |
14 |
| -#include <__type_traits/is_volatile.h> |
15 |
| -#include <__type_traits/remove_reference.h> |
| 13 | +#include <__type_traits/copy_cv.h> |
16 | 14 |
|
17 | 15 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
18 | 16 | # pragma GCC system_header
|
19 | 17 | #endif
|
20 | 18 |
|
21 | 19 | _LIBCPP_BEGIN_NAMESPACE_STD
|
22 | 20 |
|
23 |
| -template <class _Tp, |
24 |
| - bool = is_const<__libcpp_remove_reference_t<_Tp> >::value, |
25 |
| - bool = is_volatile<__libcpp_remove_reference_t<_Tp> >::value> |
26 |
| -struct __apply_cv_impl { |
27 |
| - template <class _Up> |
28 |
| - using __apply _LIBCPP_NODEBUG = _Up; |
29 |
| -}; |
30 |
| - |
31 | 21 | template <class _Tp>
|
32 |
| -struct __apply_cv_impl<_Tp, true, false> { |
33 |
| - template <class _Up> |
34 |
| - using __apply _LIBCPP_NODEBUG = const _Up; |
35 |
| -}; |
36 |
| - |
37 |
| -template <class _Tp> |
38 |
| -struct __apply_cv_impl<_Tp, false, true> { |
39 |
| - template <class _Up> |
40 |
| - using __apply _LIBCPP_NODEBUG = volatile _Up; |
41 |
| -}; |
42 |
| - |
43 |
| -template <class _Tp> |
44 |
| -struct __apply_cv_impl<_Tp, true, true> { |
45 |
| - template <class _Up> |
46 |
| - using __apply _LIBCPP_NODEBUG = const volatile _Up; |
47 |
| -}; |
48 |
| - |
49 |
| -template <class _Tp> |
50 |
| -struct __apply_cv_impl<_Tp&, false, false> { |
51 |
| - template <class _Up> |
52 |
| - using __apply _LIBCPP_NODEBUG = _Up&; |
53 |
| -}; |
54 |
| - |
55 |
| -template <class _Tp> |
56 |
| -struct __apply_cv_impl<_Tp&, true, false> { |
57 |
| - template <class _Up> |
58 |
| - using __apply _LIBCPP_NODEBUG = const _Up&; |
59 |
| -}; |
60 |
| - |
61 |
| -template <class _Tp> |
62 |
| -struct __apply_cv_impl<_Tp&, false, true> { |
| 22 | +struct __apply_cv_impl { |
63 | 23 | template <class _Up>
|
64 |
| - using __apply _LIBCPP_NODEBUG = volatile _Up&; |
| 24 | + using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>; |
65 | 25 | };
|
66 | 26 |
|
67 | 27 | template <class _Tp>
|
68 |
| -struct __apply_cv_impl<_Tp&, true, true> { |
| 28 | +struct __apply_cv_impl<_Tp&> { |
69 | 29 | template <class _Up>
|
70 |
| - using __apply _LIBCPP_NODEBUG = const volatile _Up&; |
| 30 | + using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>&; |
71 | 31 | };
|
72 | 32 |
|
73 | 33 | template <class _Tp, class _Up>
|
|
0 commit comments