[libc++] Merge is_{,un}bounded_array.h into is_array.h (#167479)

These headers are incredibly simple and closely related, so this merges
them into a single one.
This commit is contained in:
Nikolas Klauser 2025-11-13 09:29:28 +01:00 committed by GitHub
parent 189d1853e4
commit f038dfd22d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 26 additions and 92 deletions

View File

@ -822,7 +822,6 @@ set(files
__type_traits/is_array.h
__type_traits/is_assignable.h
__type_traits/is_base_of.h
__type_traits/is_bounded_array.h
__type_traits/is_callable.h
__type_traits/is_char_like_type.h
__type_traits/is_class.h
@ -872,7 +871,6 @@ set(files
__type_traits/is_trivially_destructible.h
__type_traits/is_trivially_lexicographically_comparable.h
__type_traits/is_trivially_relocatable.h
__type_traits/is_unbounded_array.h
__type_traits/is_union.h
__type_traits/is_unqualified.h
__type_traits/is_unsigned.h

View File

@ -41,13 +41,11 @@
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_bounded_array.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_unbounded_array.h>
#include <__type_traits/nat.h>
#include <__type_traits/negation.h>
#include <__type_traits/remove_cv.h>

View File

@ -32,7 +32,6 @@
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/is_unbounded_array.h>
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_extent.h>
#include <__utility/exception_guard.h>

View File

@ -32,7 +32,6 @@
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_bounded_array.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_convertible.h>
@ -42,7 +41,6 @@
#include <__type_traits/is_same.h>
#include <__type_traits/is_swappable.h>
#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/is_unbounded_array.h>
#include <__type_traits/is_void.h>
#include <__type_traits/remove_extent.h>
#include <__type_traits/type_identity.h>

View File

@ -26,6 +26,32 @@ template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp);
#endif
template <class _Tp>
inline const bool __is_bounded_array_v = __is_bounded_array(_Tp);
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : bool_constant<__is_bounded_array(_Tp)> {};
template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
#endif
template <class _Tp>
inline const bool __is_unbounded_array_v = __is_unbounded_array(_Tp);
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : bool_constant<__is_unbounded_array(_Tp)> {};
template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_ARRAY_H

View File

@ -1,36 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H
#define _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H
#include <__config>
#include <__type_traits/integral_constant.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
inline const bool __is_bounded_array_v = __is_bounded_array(_Tp);
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : bool_constant<__is_bounded_array(_Tp)> {};
template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H

View File

@ -1,38 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H
#define _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H
#include <__config>
#include <__type_traits/integral_constant.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class>
inline const bool __is_unbounded_array_v = false;
template <class _Tp>
inline const bool __is_unbounded_array_v<_Tp[]> = true;
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : bool_constant<__is_unbounded_array_v<_Tp>> {};
template <class _Tp>
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = __is_unbounded_array_v<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H

View File

@ -126,10 +126,6 @@ module std_core [system] {
header "__type_traits/is_base_of.h"
export std_core.type_traits.integral_constant
}
module is_bounded_array {
header "__type_traits/is_bounded_array.h"
export std_core.type_traits.integral_constant
}
module is_callable {
header "__type_traits/is_callable.h"
export std_core.type_traits.integral_constant
@ -323,10 +319,6 @@ module std_core [system] {
header "__type_traits/is_trivially_relocatable.h"
export std_core.type_traits.integral_constant
}
module is_unbounded_array {
header "__type_traits/is_unbounded_array.h"
export std_core.type_traits.integral_constant
}
module is_union {
header "__type_traits/is_union.h"
export std_core.type_traits.integral_constant

View File

@ -238,7 +238,6 @@ namespace std {
# include <__type_traits/is_trivially_constructible.h>
# include <__type_traits/is_trivially_destructible.h>
# include <__type_traits/is_trivially_relocatable.h>
# include <__type_traits/is_unbounded_array.h>
# include <__type_traits/negation.h>
# include <__type_traits/reference_constructs_from_temporary.h>
# include <__type_traits/remove_const.h>

View File

@ -550,9 +550,7 @@ namespace std
# if _LIBCPP_STD_VER >= 20
# include <__type_traits/common_reference.h>
# include <__type_traits/is_bounded_array.h>
# include <__type_traits/is_constant_evaluated.h>
# include <__type_traits/is_unbounded_array.h>
# include <__type_traits/type_identity.h>
# include <__type_traits/unwrap_ref.h>
# endif