Skip to content

Commit 4cde945

Browse files
authored
[libc++][NFC] Remove public from the type traits (#135088)
The type traits are always `struct`s, so the `public` isn't necessary. We're currently using `public` in some places, while we omit it in others. This makes us consistent across the type traits.
1 parent cb43fe3 commit 4cde945

36 files changed

+94
-103
lines changed

libcxx/include/__type_traits/is_abstract.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _Tp>
22-
struct _LIBCPP_NO_SPECIALIZATIONS is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {};
22+
struct _LIBCPP_NO_SPECIALIZATIONS is_abstract : integral_constant<bool, __is_abstract(_Tp)> {};
2323

2424
#if _LIBCPP_STD_VER >= 17
2525
template <class _Tp>

libcxx/include/__type_traits/is_aggregate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
#if _LIBCPP_STD_VER >= 17
2222

2323
template <class _Tp>
24-
struct _LIBCPP_NO_SPECIALIZATIONS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
24+
struct _LIBCPP_NO_SPECIALIZATIONS is_aggregate : integral_constant<bool, __is_aggregate(_Tp)> {};
2525

2626
template <class _Tp>
2727
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_aggregate_v = __is_aggregate(_Tp);

libcxx/include/__type_traits/is_arithmetic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222

2323
template <class _Tp>
2424
struct _LIBCPP_NO_SPECIALIZATIONS is_arithmetic
25-
: public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
25+
: integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
2626

2727
#if _LIBCPP_STD_VER >= 17
2828
template <class _Tp>

libcxx/include/__type_traits/is_assignable.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_assignable_v = __is_assignab
3030

3131
template <class _Tp>
3232
struct _LIBCPP_NO_SPECIALIZATIONS is_copy_assignable
33-
: public integral_constant<bool,
34-
__is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<const _Tp>)> {};
33+
: integral_constant<bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<const _Tp>)> {};
3534

3635
#if _LIBCPP_STD_VER >= 17
3736
template <class _Tp>
@@ -40,7 +39,7 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_copy_assignable_v = is_copy_
4039

4140
template <class _Tp>
4241
struct _LIBCPP_NO_SPECIALIZATIONS is_move_assignable
43-
: public integral_constant<bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {};
42+
: integral_constant<bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {};
4443

4544
#if _LIBCPP_STD_VER >= 17
4645
template <class _Tp>

libcxx/include/__type_traits/is_base_of.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _Bp, class _Dp>
22-
struct _LIBCPP_NO_SPECIALIZATIONS is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
22+
struct _LIBCPP_NO_SPECIALIZATIONS is_base_of : integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
2323

2424
#if _LIBCPP_STD_VER >= 17
2525
template <class _Bp, class _Dp>
@@ -30,8 +30,7 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_base_of_v = __is_base_of(_Bp
3030
# if __has_builtin(__builtin_is_virtual_base_of)
3131

3232
template <class _Base, class _Derived>
33-
struct _LIBCPP_NO_SPECIALIZATIONS is_virtual_base_of
34-
: public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> {};
33+
struct _LIBCPP_NO_SPECIALIZATIONS is_virtual_base_of : bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> {};
3534

3635
template <class _Base, class _Derived>
3736
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived);

libcxx/include/__type_traits/is_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _Tp>
22-
struct _LIBCPP_NO_SPECIALIZATIONS is_class : public integral_constant<bool, __is_class(_Tp)> {};
22+
struct _LIBCPP_NO_SPECIALIZATIONS is_class : integral_constant<bool, __is_class(_Tp)> {};
2323

2424
#if _LIBCPP_STD_VER >= 17
2525
template <class _Tp>

libcxx/include/__type_traits/is_constructible.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
_LIBCPP_BEGIN_NAMESPACE_STD
2222

2323
template <class _Tp, class... _Args>
24-
struct _LIBCPP_NO_SPECIALIZATIONS is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> {
25-
};
24+
struct _LIBCPP_NO_SPECIALIZATIONS is_constructible : integral_constant<bool, __is_constructible(_Tp, _Args...)> {};
2625

2726
#if _LIBCPP_STD_VER >= 17
2827
template <class _Tp, class... _Args>
@@ -31,7 +30,7 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_constructible_v = __is_const
3130

3231
template <class _Tp>
3332
struct _LIBCPP_NO_SPECIALIZATIONS is_copy_constructible
34-
: public integral_constant<bool, __is_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
33+
: integral_constant<bool, __is_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
3534

3635
#if _LIBCPP_STD_VER >= 17
3736
template <class _Tp>
@@ -40,15 +39,15 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_copy_constructible_v = is_co
4039

4140
template <class _Tp>
4241
struct _LIBCPP_NO_SPECIALIZATIONS is_move_constructible
43-
: public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
42+
: integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
4443

4544
#if _LIBCPP_STD_VER >= 17
4645
template <class _Tp>
4746
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value;
4847
#endif
4948

5049
template <class _Tp>
51-
struct _LIBCPP_NO_SPECIALIZATIONS is_default_constructible : public integral_constant<bool, __is_constructible(_Tp)> {};
50+
struct _LIBCPP_NO_SPECIALIZATIONS is_default_constructible : integral_constant<bool, __is_constructible(_Tp)> {};
5251

5352
#if _LIBCPP_STD_VER >= 17
5453
template <class _Tp>

libcxx/include/__type_traits/is_convertible.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

2121
template <class _T1, class _T2>
22-
struct _LIBCPP_NO_SPECIALIZATIONS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
22+
struct _LIBCPP_NO_SPECIALIZATIONS is_convertible : integral_constant<bool, __is_convertible(_T1, _T2)> {};
2323

2424
#if _LIBCPP_STD_VER >= 17
2525
template <class _From, class _To>

libcxx/include/__type_traits/is_core_convertible.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424
// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later.
2525

2626
template <class _Tp, class _Up, class = void>
27-
struct __is_core_convertible : public false_type {};
27+
struct __is_core_convertible : false_type {};
2828

2929
template <class _Tp, class _Up>
3030
struct __is_core_convertible<_Tp, _Up, decltype(static_cast<void (*)(_Up)>(0)(static_cast<_Tp (*)()>(0)()))>
31-
: public true_type {};
31+
: true_type {};
3232

3333
_LIBCPP_END_NAMESPACE_STD
3434

libcxx/include/__type_traits/is_destructible.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,28 @@ struct __destructible_imp;
6262

6363
template <class _Tp>
6464
struct __destructible_imp<_Tp, false>
65-
: public integral_constant<bool, __is_destructor_wellformed<__remove_all_extents_t<_Tp> >::value> {};
65+
: integral_constant<bool, __is_destructor_wellformed<__remove_all_extents_t<_Tp> >::value> {};
6666

6767
template <class _Tp>
68-
struct __destructible_imp<_Tp, true> : public true_type {};
68+
struct __destructible_imp<_Tp, true> : true_type {};
6969

7070
template <class _Tp, bool>
7171
struct __destructible_false;
7272

7373
template <class _Tp>
74-
struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, is_reference<_Tp>::value> {};
74+
struct __destructible_false<_Tp, false> : __destructible_imp<_Tp, is_reference<_Tp>::value> {};
7575

7676
template <class _Tp>
77-
struct __destructible_false<_Tp, true> : public false_type {};
77+
struct __destructible_false<_Tp, true> : false_type {};
7878

7979
template <class _Tp>
80-
struct is_destructible : public __destructible_false<_Tp, is_function<_Tp>::value> {};
80+
struct is_destructible : __destructible_false<_Tp, is_function<_Tp>::value> {};
8181

8282
template <class _Tp>
83-
struct is_destructible<_Tp[]> : public false_type {};
83+
struct is_destructible<_Tp[]> : false_type {};
8484

8585
template <>
86-
struct is_destructible<void> : public false_type {};
86+
struct is_destructible<void> : false_type {};
8787

8888
# if _LIBCPP_STD_VER >= 17
8989
template <class _Tp>

0 commit comments

Comments
 (0)