diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2024-03-29 11:42:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 11:42:28 +0100 |
commit | a85569242da98c29d76fbb303a4014cf6c514a6f (patch) | |
tree | 0b341c19e2fd9b8ff53fa35486a56d98bbfaa107 | |
parent | 5af767926288f837e4fd9fd81a9d4878e0924ced (diff) |
[libc++][NFC] Use __copy_cv to implement __apply_cv (#86477)
-rw-r--r-- | libcxx/include/__type_traits/apply_cv.h | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/libcxx/include/__type_traits/apply_cv.h b/libcxx/include/__type_traits/apply_cv.h index 7c6aabec8344..723af95b8d92 100644 --- a/libcxx/include/__type_traits/apply_cv.h +++ b/libcxx/include/__type_traits/apply_cv.h @@ -10,9 +10,7 @@ #define _LIBCPP___TYPE_TRAITS_APPLY_CV_H #include <__config> -#include <__type_traits/is_const.h> -#include <__type_traits/is_volatile.h> -#include <__type_traits/remove_reference.h> +#include <__type_traits/copy_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,54 +18,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Tp, - bool = is_const<__libcpp_remove_reference_t<_Tp> >::value, - bool = is_volatile<__libcpp_remove_reference_t<_Tp> >::value> -struct __apply_cv_impl { - template <class _Up> - using __apply _LIBCPP_NODEBUG = _Up; -}; - template <class _Tp> -struct __apply_cv_impl<_Tp, true, false> { - template <class _Up> - using __apply _LIBCPP_NODEBUG = const _Up; -}; - -template <class _Tp> -struct __apply_cv_impl<_Tp, false, true> { - template <class _Up> - using __apply _LIBCPP_NODEBUG = volatile _Up; -}; - -template <class _Tp> -struct __apply_cv_impl<_Tp, true, true> { - template <class _Up> - using __apply _LIBCPP_NODEBUG = const volatile _Up; -}; - -template <class _Tp> -struct __apply_cv_impl<_Tp&, false, false> { - template <class _Up> - using __apply _LIBCPP_NODEBUG = _Up&; -}; - -template <class _Tp> -struct __apply_cv_impl<_Tp&, true, false> { - template <class _Up> - using __apply _LIBCPP_NODEBUG = const _Up&; -}; - -template <class _Tp> -struct __apply_cv_impl<_Tp&, false, true> { +struct __apply_cv_impl { template <class _Up> - using __apply _LIBCPP_NODEBUG = volatile _Up&; + using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>; }; template <class _Tp> -struct __apply_cv_impl<_Tp&, true, true> { +struct __apply_cv_impl<_Tp&> { template <class _Up> - using __apply _LIBCPP_NODEBUG = const volatile _Up&; + using __apply _LIBCPP_NODEBUG = __copy_cv_t<_Tp, _Up>&; }; template <class _Tp, class _Up> |