Skip to content

Commit 12c3034

Browse files
committed
[libc++] Simplify is_array and is_nothrow_convertible
1 parent 6c9e098 commit 12c3034

File tree

6 files changed

+12
-90
lines changed

6 files changed

+12
-90
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,6 @@ set(files
829829
__type_traits/is_member_pointer.h
830830
__type_traits/is_nothrow_assignable.h
831831
__type_traits/is_nothrow_constructible.h
832-
__type_traits/is_nothrow_convertible.h
833832
__type_traits/is_nothrow_destructible.h
834833
__type_traits/is_null_pointer.h
835834
__type_traits/is_object.h

libcxx/include/__type_traits/is_array.h

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define _LIBCPP___TYPE_TRAITS_IS_ARRAY_H
1111

1212
#include <__config>
13-
#include <__cstddef/size_t.h>
1413
#include <__type_traits/integral_constant.h>
1514

1615
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -19,32 +18,13 @@
1918

2019
_LIBCPP_BEGIN_NAMESPACE_STD
2120

22-
#if __has_builtin(__is_array) && \
23-
(!defined(_LIBCPP_COMPILER_CLANG_BASED) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1900))
24-
2521
template <class _Tp>
2622
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_array : _BoolConstant<__is_array(_Tp)> {};
2723

28-
# if _LIBCPP_STD_VER >= 17
24+
#if _LIBCPP_STD_VER >= 17
2925
template <class _Tp>
3026
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp);
31-
# endif
32-
33-
#else
34-
35-
template <class _Tp>
36-
struct _LIBCPP_TEMPLATE_VIS is_array : public false_type {};
37-
template <class _Tp>
38-
struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> : public true_type {};
39-
template <class _Tp, size_t _Np>
40-
struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {};
41-
42-
# if _LIBCPP_STD_VER >= 17
43-
template <class _Tp>
44-
inline constexpr bool is_array_v = is_array<_Tp>::value;
45-
# endif
46-
47-
#endif // __has_builtin(__is_array)
27+
#endif
4828

4929
_LIBCPP_END_NAMESPACE_STD
5030

libcxx/include/__type_traits/is_convertible.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ template <class _From, class _To>
2727
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
2828
#endif
2929

30+
#if _LIBCPP_STD_VER >= 20
31+
32+
template <class _Tp, class _Up>
33+
struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
34+
35+
template <class _Tp, class _Up>
36+
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);
37+
38+
#endif // _LIBCPP_STD_VER >= 20
39+
3040
_LIBCPP_END_NAMESPACE_STD
3141

3242
#endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H

libcxx/include/__type_traits/is_nothrow_convertible.h

Lines changed: 0 additions & 62 deletions
This file was deleted.

libcxx/include/module.modulemap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ module std_core [system] {
231231
header "__type_traits/is_nothrow_constructible.h"
232232
export std_core.type_traits.integral_constant
233233
}
234-
module is_nothrow_convertible {
235-
header "__type_traits/is_nothrow_convertible.h"
236-
export std_core.type_traits.integral_constant
237-
}
238234
module is_nothrow_destructible {
239235
header "__type_traits/is_nothrow_destructible.h"
240236
export std_core.type_traits.integral_constant

libcxx/include/type_traits

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ namespace std
549549
# include <__type_traits/common_reference.h>
550550
# include <__type_traits/is_bounded_array.h>
551551
# include <__type_traits/is_constant_evaluated.h>
552-
# include <__type_traits/is_nothrow_convertible.h>
553552
# include <__type_traits/is_unbounded_array.h>
554553
# include <__type_traits/type_identity.h>
555554
# include <__type_traits/unwrap_ref.h>

0 commit comments

Comments
 (0)