Skip to content

Commit a855692

Browse files
authored
[libc++][NFC] Use __copy_cv to implement __apply_cv (#86477)
1 parent 5af7679 commit a855692

File tree

1 file changed

+5
-45
lines changed

1 file changed

+5
-45
lines changed

libcxx/include/__type_traits/apply_cv.h

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,24 @@
1010
#define _LIBCPP___TYPE_TRAITS_APPLY_CV_H
1111

1212
#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>
1614

1715
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1816
# pragma GCC system_header
1917
#endif
2018

2119
_LIBCPP_BEGIN_NAMESPACE_STD
2220

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-
3121
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 {
6323
template <class _Up>
64-
using __apply _LIBCPP_NODEBUG = volatile _Up&;
24+
using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>;
6525
};
6626

6727
template <class _Tp>
68-
struct __apply_cv_impl<_Tp&, true, true> {
28+
struct __apply_cv_impl<_Tp&> {
6929
template <class _Up>
70-
using __apply _LIBCPP_NODEBUG = const volatile _Up&;
30+
using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>&;
7131
};
7232

7333
template <class _Tp, class _Up>

0 commit comments

Comments
 (0)