Skip to content

Commit b749675

Browse files
committed
[libc++][NFC] Use GCC type traits builtins
1 parent dce77a3 commit b749675

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

libcxx/include/__type_traits/remove_cv.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,17 @@
1919

2020
_LIBCPP_BEGIN_NAMESPACE_STD
2121

22-
#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC)
2322
template <class _Tp>
2423
struct remove_cv {
2524
using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
2625
};
2726

27+
#if defined(_LIBCPP_COMPILER_GCC)
2828
template <class _Tp>
29-
using __remove_cv_t = __remove_cv(_Tp);
29+
using __remove_cv_t = typename remove_cv<_Tp>::type;
3030
#else
3131
template <class _Tp>
32-
struct _LIBCPP_TEMPLATE_VIS remove_cv {
33-
typedef __remove_volatile_t<__remove_const_t<_Tp> > type;
34-
};
35-
36-
template <class _Tp>
37-
using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >;
32+
using __remove_cv_t = __remove_cv(_Tp);
3833
#endif // __has_builtin(__remove_cv)
3934

4035
#if _LIBCPP_STD_VER >= 14

libcxx/include/__type_traits/remove_cvref.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,26 @@
2020

2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

23-
#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC)
23+
#if defined(_LIBCPP_COMPILER_GCC)
2424
template <class _Tp>
25-
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
25+
struct __remove_cvref_gcc {
26+
using type = __remove_cvref(_Tp);
27+
};
28+
29+
template <class _Tp>
30+
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref_gcc<_Tp>::type;
2631
#else
2732
template <class _Tp>
28-
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
33+
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
2934
#endif // __has_builtin(__remove_cvref)
3035

3136
template <class _Tp, class _Up>
32-
struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {};
37+
using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >;
3338

3439
#if _LIBCPP_STD_VER >= 20
3540
template <class _Tp>
3641
struct remove_cvref {
37-
using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
42+
using type _LIBCPP_NODEBUG = __remove_cvref(_Tp);
3843
};
3944

4045
template <class _Tp>

0 commit comments

Comments
 (0)