Skip to content

[libc++] Simplify is_array and is_nothrow_convertible #134491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ set(files
__type_traits/is_member_pointer.h
__type_traits/is_nothrow_assignable.h
__type_traits/is_nothrow_constructible.h
__type_traits/is_nothrow_convertible.h
__type_traits/is_nothrow_destructible.h
__type_traits/is_null_pointer.h
__type_traits/is_object.h
Expand Down
24 changes: 2 additions & 22 deletions libcxx/include/__type_traits/is_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_IS_ARRAY_H

#include <__config>
#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Expand All @@ -19,32 +18,13 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if __has_builtin(__is_array) && \
(!defined(_LIBCPP_COMPILER_CLANG_BASED) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1900))

template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_array : _BoolConstant<__is_array(_Tp)> {};

# if _LIBCPP_STD_VER >= 17
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp);
# endif

#else

template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_array : public false_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> : public true_type {};
template <class _Tp, size_t _Np>
struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {};

# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_array_v = is_array<_Tp>::value;
# endif

#endif // __has_builtin(__is_array)
#endif

_LIBCPP_END_NAMESPACE_STD

Expand Down
10 changes: 10 additions & 0 deletions libcxx/include/__type_traits/is_convertible.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ template <class _From, class _To>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
#endif

#if _LIBCPP_STD_VER >= 20

template <class _Tp, class _Up>
struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};

template <class _Tp, class _Up>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);

#endif // _LIBCPP_STD_VER >= 20

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H
62 changes: 0 additions & 62 deletions libcxx/include/__type_traits/is_nothrow_convertible.h

This file was deleted.

4 changes: 0 additions & 4 deletions libcxx/include/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,6 @@ module std_core [system] {
header "__type_traits/is_nothrow_constructible.h"
export std_core.type_traits.integral_constant
}
module is_nothrow_convertible {
header "__type_traits/is_nothrow_convertible.h"
export std_core.type_traits.integral_constant
}
module is_nothrow_destructible {
header "__type_traits/is_nothrow_destructible.h"
export std_core.type_traits.integral_constant
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ namespace std
# include <__type_traits/common_reference.h>
# include <__type_traits/is_bounded_array.h>
# include <__type_traits/is_constant_evaluated.h>
# include <__type_traits/is_nothrow_convertible.h>
# include <__type_traits/is_unbounded_array.h>
# include <__type_traits/type_identity.h>
# include <__type_traits/unwrap_ref.h>
Expand Down
Loading