[libcxx-commits] [libcxx] eebc1fb - [libc++] Granularize parts of <type_traits>
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 23 11:44:13 PDT 2022
Author: Nikolas Klauser
Date: 2022-05-23T20:43:27+02:00
New Revision: eebc1fb772c56df9958fb916b41ff3c329fae145
URL: https://github.com/llvm/llvm-project/commit/eebc1fb772c56df9958fb916b41ff3c329fae145
DIFF: https://github.com/llvm/llvm-project/commit/eebc1fb772c56df9958fb916b41ff3c329fae145.diff
LOG: [libc++] Granularize parts of <type_traits>
`<type_traits>` is quite a large header, so I'll granularize it in a few steps.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D124755
Added:
libcxx/include/__type_traits/add_pointer.h
libcxx/include/__type_traits/conditional.h
libcxx/include/__type_traits/decay.h
libcxx/include/__type_traits/enable_if.h
libcxx/include/__type_traits/is_array.h
libcxx/include/__type_traits/is_base_of.h
libcxx/include/__type_traits/is_const.h
libcxx/include/__type_traits/is_convertible.h
libcxx/include/__type_traits/is_floating_point.h
libcxx/include/__type_traits/is_function.h
libcxx/include/__type_traits/is_integral.h
libcxx/include/__type_traits/is_member_function_pointer.h
libcxx/include/__type_traits/is_member_object_pointer.h
libcxx/include/__type_traits/is_null_pointer.h
libcxx/include/__type_traits/is_reference.h
libcxx/include/__type_traits/is_reference_wrapper.h
libcxx/include/__type_traits/is_referenceable.h
libcxx/include/__type_traits/is_same.h
libcxx/include/__type_traits/is_void.h
libcxx/include/__type_traits/is_volatile.h
libcxx/include/__type_traits/remove_const.h
libcxx/include/__type_traits/remove_cv.h
libcxx/include/__type_traits/remove_extent.h
libcxx/include/__type_traits/remove_reference.h
libcxx/include/__type_traits/remove_volatile.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/cstddef
libcxx/include/module.modulemap
libcxx/include/type_traits
libcxx/test/libcxx/private_headers.verify.cpp
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index d7aa09e2c8580..74336ed19703e 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -431,8 +431,33 @@ set(files
__threading_support
__tree
__tuple
+ __type_traits/add_pointer.h
+ __type_traits/conditional.h
+ __type_traits/decay.h
+ __type_traits/enable_if.h
__type_traits/integral_constant.h
+ __type_traits/is_array.h
+ __type_traits/is_base_of.h
__type_traits/is_callable.h
+ __type_traits/is_const.h
+ __type_traits/is_convertible.h
+ __type_traits/is_floating_point.h
+ __type_traits/is_function.h
+ __type_traits/is_integral.h
+ __type_traits/is_member_function_pointer.h
+ __type_traits/is_member_object_pointer.h
+ __type_traits/is_null_pointer.h
+ __type_traits/is_reference.h
+ __type_traits/is_reference_wrapper.h
+ __type_traits/is_referenceable.h
+ __type_traits/is_same.h
+ __type_traits/is_void.h
+ __type_traits/is_volatile.h
+ __type_traits/remove_const.h
+ __type_traits/remove_cv.h
+ __type_traits/remove_extent.h
+ __type_traits/remove_reference.h
+ __type_traits/remove_volatile.h
__undef_macros
__utility/as_const.h
__utility/auto_cast.h
diff --git a/libcxx/include/__type_traits/add_pointer.h b/libcxx/include/__type_traits/add_pointer.h
new file mode 100644
index 0000000000000..aea2490c5d0cc
--- /dev/null
+++ b/libcxx/include/__type_traits/add_pointer.h
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_ADD_POINTER_H
+#define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H
+
+#include <__config>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_reference.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp,
+ bool = __is_referenceable<_Tp>::value ||
+ _IsSame<typename remove_cv<_Tp>::type, void>::value>
+struct __add_pointer_impl
+ {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;};
+template <class _Tp> struct __add_pointer_impl<_Tp, false>
+ {typedef _LIBCPP_NODEBUG _Tp type;};
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
+ {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_ADD_POINTER_H
diff --git a/libcxx/include/__type_traits/conditional.h b/libcxx/include/__type_traits/conditional.h
new file mode 100644
index 0000000000000..ef182a9ed6550
--- /dev/null
+++ b/libcxx/include/__type_traits/conditional.h
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CONDITIONAL_H
+#define _LIBCPP___TYPE_TRAITS_CONDITIONAL_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <bool _Bp, class _If, class _Then>
+ struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
+template <class _If, class _Then>
+ struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;};
+
+#if _LIBCPP_STD_VER > 11
+template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_CONDITIONAL_H
diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h
new file mode 100644
index 0000000000000..d47ad03fe0082
--- /dev/null
+++ b/libcxx/include/__type_traits/decay.h
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_DECAY_H
+#define _LIBCPP___TYPE_TRAITS_DECAY_H
+
+#include <__config>
+#include <__type_traits/add_pointer.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_extent.h>
+#include <__type_traits/remove_reference.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Up, bool>
+struct __decay {
+ typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type;
+};
+
+template <class _Up>
+struct __decay<_Up, true> {
+public:
+ typedef _LIBCPP_NODEBUG typename conditional
+ <
+ is_array<_Up>::value,
+ typename remove_extent<_Up>::type*,
+ typename conditional
+ <
+ is_function<_Up>::value,
+ typename add_pointer<_Up>::type,
+ typename remove_cv<_Up>::type
+ >::type
+ >::type type;
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS decay
+{
+private:
+ typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up;
+public:
+ typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using decay_t = typename decay<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_DECAY_H
diff --git a/libcxx/include/__type_traits/enable_if.h b/libcxx/include/__type_traits/enable_if.h
new file mode 100644
index 0000000000000..d7ccd6fd0368f
--- /dev/null
+++ b/libcxx/include/__type_traits/enable_if.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_ENABLE_IF_H
+#define _LIBCPP___TYPE_TRAITS_ENABLE_IF_H
+
+#include <__config>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
+
+template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;
+
+#if _LIBCPP_STD_VER > 11
+template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_ENABLE_IF_H
diff --git a/libcxx/include/__type_traits/is_array.h b/libcxx/include/__type_traits/is_array.h
new file mode 100644
index 0000000000000..766d2a2030287
--- /dev/null
+++ b/libcxx/include/__type_traits/is_array.h
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_ARRAY_H
+#define _LIBCPP___TYPE_TRAITS_IS_ARRAY_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// TODO: Clang incorrectly reports that __is_array is true for T[0].
+// Re-enable the branch once https://llvm.org/PR54705 is fixed.
+#if __has_keyword(__is_array) && 0
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+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 > 14
+template <class _Tp>
+inline constexpr bool is_array_v = is_array<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_array)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_ARRAY_H
diff --git a/libcxx/include/__type_traits/is_base_of.h b/libcxx/include/__type_traits/is_base_of.h
new file mode 100644
index 0000000000000..b944a65d2823b
--- /dev/null
+++ b/libcxx/include/__type_traits/is_base_of.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_BASE_OF_H
+#define _LIBCPP___TYPE_TRAITS_IS_BASE_OF_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 _Bp, class _Dp>
+struct _LIBCPP_TEMPLATE_VIS is_base_of
+ : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Bp, class _Dp>
+inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_BASE_OF_H
diff --git a/libcxx/include/__type_traits/is_const.h b/libcxx/include/__type_traits/is_const.h
new file mode 100644
index 0000000000000..5501832f560ba
--- /dev/null
+++ b/libcxx/include/__type_traits/is_const.h
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CONST_H
+#define _LIBCPP___TYPE_TRAITS_IS_CONST_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
+
+#if __has_keyword(__is_const)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_const_v = __is_const(_Tp);
+#endif
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_const_v = is_const<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_const)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_CONST_H
diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h
new file mode 100644
index 0000000000000..884e808e2ae4d
--- /dev/null
+++ b/libcxx/include/__type_traits/is_convertible.h
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CONVERTIBLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/remove_reference.h>
+#include <__utility/declval.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+
+template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
+ : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
+
+#else // __has_feature(is_convertible_to)
+
+namespace __is_convertible_imp
+{
+template <class _Tp> void __test_convert(_Tp);
+
+template <class _From, class _To, class = void>
+struct __is_convertible_test : public false_type {};
+
+template <class _From, class _To>
+struct __is_convertible_test<_From, _To,
+ decltype(__is_convertible_imp::__test_convert<_To>(declval<_From>()))> : public true_type
+{};
+
+template <class _Tp, bool _IsArray = is_array<_Tp>::value,
+ bool _IsFunction = is_function<_Tp>::value,
+ bool _IsVoid = is_void<_Tp>::value>
+ struct __is_array_function_or_void {enum {value = 0};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
+}
+
+template <class _Tp,
+ unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
+struct __is_convertible_check
+{
+ static const size_t __v = 0;
+};
+
+template <class _Tp>
+struct __is_convertible_check<_Tp, 0>
+{
+ static const size_t __v = sizeof(_Tp);
+};
+
+template <class _T1, class _T2,
+ unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
+ unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
+struct __is_convertible
+ : public integral_constant<bool,
+ __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
+ >
+{};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
+
+template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
+ : public __is_convertible<_T1, _T2>
+{
+ static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
+ static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
+};
+
+#endif // __has_feature(is_convertible_to)
+
+#if _LIBCPP_STD_VER > 14
+template <class _From, class _To>
+inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_CONVERTIBLE_H
diff --git a/libcxx/include/__type_traits/is_floating_point.h b/libcxx/include/__type_traits/is_floating_point.h
new file mode 100644
index 0000000000000..d93e5d99d07b8
--- /dev/null
+++ b/libcxx/include/__type_traits/is_floating_point.h
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_FLOATING_POINT_H
+#define _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_cv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
+template <> struct __libcpp_is_floating_point<float> : public true_type {};
+template <> struct __libcpp_is_floating_point<double> : public true_type {};
+template <> struct __libcpp_is_floating_point<long double> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point
+ : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H
diff --git a/libcxx/include/__type_traits/is_function.h b/libcxx/include/__type_traits/is_function.h
new file mode 100644
index 0000000000000..23ba9cbb0dd63
--- /dev/null
+++ b/libcxx/include/__type_traits/is_function.h
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_FUNCTIONAL_H
+#define _LIBCPP___TYPE_TRAITS_IS_FUNCTIONAL_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_const.h>
+#include <__type_traits/is_reference.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function
+ : public _BoolConstant<
+#ifdef __clang__
+ __is_function(_Tp)
+#else
+ !(is_reference<_Tp>::value || is_const<const _Tp>::value)
+#endif
+ > {};
+
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_function_v = is_function<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_FUNCTIONAL_H
diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h
new file mode 100644
index 0000000000000..7df964f992851
--- /dev/null
+++ b/libcxx/include/__type_traits/is_integral.h
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_INTEGRAL_H
+#define _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_cv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; };
+template <> struct __libcpp_is_integral<bool> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<char> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<signed char> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<unsigned char> { enum { value = 1 }; };
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; };
+#endif
+#ifndef _LIBCPP_HAS_NO_CHAR8_T
+template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; };
+#endif
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; };
+#endif
+template <> struct __libcpp_is_integral<short> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<int> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<unsigned int> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<long> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<unsigned long> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<long long> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; };
+#ifndef _LIBCPP_HAS_NO_INT128
+template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; };
+template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; };
+#endif
+
+#if __has_keyword(__is_integral)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_integral_v = __is_integral(_Tp);
+#endif
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral
+ : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_integral_v = is_integral<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_integral)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H
diff --git a/libcxx/include/__type_traits/is_member_function_pointer.h b/libcxx/include/__type_traits/is_member_function_pointer.h
new file mode 100644
index 0000000000000..f18f3ebc5a3a6
--- /dev/null
+++ b/libcxx/include/__type_traits/is_member_function_pointer.h
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_MEMBER_FUNCTION_POINTER_H
+#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/remove_cv.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct __libcpp_is_member_pointer {
+ enum {
+ __is_member = false,
+ __is_func = false,
+ __is_obj = false
+ };
+};
+template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> {
+ enum {
+ __is_member = true,
+ __is_func = is_function<_Tp>::value,
+ __is_obj = !__is_func,
+ };
+};
+
+#if __has_keyword(__is_member_function_pointer)
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
+ : _BoolConstant<__is_member_function_pointer(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
+#endif
+
+#else // __has_keyword(__is_member_function_pointer)
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
+ : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_member_function_pointer)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H
diff --git a/libcxx/include/__type_traits/is_member_object_pointer.h b/libcxx/include/__type_traits/is_member_object_pointer.h
new file mode 100644
index 0000000000000..41f81d529388e
--- /dev/null
+++ b/libcxx/include/__type_traits/is_member_object_pointer.h
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_MEMBER_OBJECT_POINTER_H
+#define _LIBCPP___TYPE_TRAITS_IS_MEMBER_OBJECT_POINTER_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
+
+#if __has_keyword(__is_member_object_pointer)
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
+ : _BoolConstant<__is_member_object_pointer(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
+#endif
+
+#else // __has_keyword(__is_member_object_pointer)
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
+ : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_member_object_pointer)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H
diff --git a/libcxx/include/__type_traits/is_null_pointer.h b/libcxx/include/__type_traits/is_null_pointer.h
new file mode 100644
index 0000000000000..f81cb9aadb2f1
--- /dev/null
+++ b/libcxx/include/__type_traits/is_null_pointer.h
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_NULL_POINTER_H
+#define _LIBCPP___TYPE_TRAITS_IS_NULL_POINTER_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_cv.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
+template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t
+ : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer
+ : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
+#endif
+#endif // _LIBCPP_STD_VER > 11
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_NULL_POINTER_H
diff --git a/libcxx/include/__type_traits/is_reference.h b/libcxx/include/__type_traits/is_reference.h
new file mode 100644
index 0000000000000..8aa55c13ff83e
--- /dev/null
+++ b/libcxx/include/__type_traits/is_reference.h
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REFERENCE_H
+#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_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
+
+#if __has_keyword(__is_lvalue_reference) && \
+ __has_keyword(__is_rvalue_reference) && \
+ __has_keyword(__is_reference)
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { };
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_reference_v = __is_reference(_Tp);
+template <class _Tp>
+inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp);
+template <class _Tp>
+inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp);
+#endif
+
+#else // __has_keyword(__is_lvalue_reference) && etc...
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_reference_v = is_reference<_Tp>::value;
+
+template <class _Tp>
+inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
+
+template <class _Tp>
+inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_lvalue_reference) && etc...
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCE_H
diff --git a/libcxx/include/__type_traits/is_reference_wrapper.h b/libcxx/include/__type_traits/is_reference_wrapper.h
new file mode 100644
index 0000000000000..cd391bb07e78d
--- /dev/null
+++ b/libcxx/include/__type_traits/is_reference_wrapper.h
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REFERENCE_WRAPPER_H
+#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_WRAPPER_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_cv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
+
+template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
+template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
+template <class _Tp> struct __is_reference_wrapper
+ : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_ENABLE_IF_H
diff --git a/libcxx/include/__type_traits/is_referenceable.h b/libcxx/include/__type_traits/is_referenceable.h
new file mode 100644
index 0000000000000..6d98a3db997ea
--- /dev/null
+++ b/libcxx/include/__type_traits/is_referenceable.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REFERENCEABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_same.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct __two {char __lx[2];};
+
+struct __is_referenceable_impl {
+ template <class _Tp> static _Tp& __test(int);
+ template <class _Tp> static __two __test(...);
+};
+
+template <class _Tp>
+struct __is_referenceable : integral_constant<bool,
+ _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
diff --git a/libcxx/include/__type_traits/is_same.h b/libcxx/include/__type_traits/is_same.h
new file mode 100644
index 0000000000000..6fa0afbc18cad
--- /dev/null
+++ b/libcxx/include/__type_traits/is_same.h
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_SAME_H
+#define _LIBCPP___TYPE_TRAITS_IS_SAME_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, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp, class _Up>
+inline constexpr bool is_same_v = __is_same(_Tp, _Up);
+#endif
+
+// _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types:
+// is_same<A,B> and is_same<C,D> are guaranteed to be
diff erent types, but
+// _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type).
+// Neither GCC nor Clang can mangle the __is_same builtin, so _IsSame
+// mustn't be directly used anywhere that contributes to name-mangling
+// (such as in a dependent return type).
+
+template <class _Tp, class _Up>
+using _IsSame = _BoolConstant<__is_same(_Tp, _Up)>;
+
+template <class _Tp, class _Up>
+using _IsNotSame = _BoolConstant<!__is_same(_Tp, _Up)>;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_SAME_H
diff --git a/libcxx/include/__type_traits/is_void.h b/libcxx/include/__type_traits/is_void.h
new file mode 100644
index 0000000000000..29e68cc529dfa
--- /dev/null
+++ b/libcxx/include/__type_traits/is_void.h
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_VOID_H
+#define _LIBCPP___TYPE_TRAITS_IS_VOID_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
+
+#if __has_keyword(__is_void)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_void_v = __is_void(_Tp);
+#endif
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void
+ : public is_same<typename remove_cv<_Tp>::type, void> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_void_v = is_void<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_void)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_VOID_H
diff --git a/libcxx/include/__type_traits/is_volatile.h b/libcxx/include/__type_traits/is_volatile.h
new file mode 100644
index 0000000000000..372703e7ced6a
--- /dev/null
+++ b/libcxx/include/__type_traits/is_volatile.h
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_VOLATILE_H
+#define _LIBCPP___TYPE_TRAITS_IS_VOLATILE_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
+
+#if __has_keyword(__is_volatile)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_volatile_v = __is_volatile(_Tp);
+#endif
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
+#endif
+
+#endif // __has_keyword(__is_volatile)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_VOLATILE_H
diff --git a/libcxx/include/__type_traits/remove_const.h b/libcxx/include/__type_traits/remove_const.h
new file mode 100644
index 0000000000000..8efc893e965a6
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_const.h
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REMOVE_CONST_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_CONST_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CONST_H
diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h
new file mode 100644
index 0000000000000..ce1e4e45c6d13
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_cv.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REMOVE_CV_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_CV_H
+
+#include <__config>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_volatile.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
+{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CV_H
diff --git a/libcxx/include/__type_traits/remove_extent.h b/libcxx/include/__type_traits/remove_extent.h
new file mode 100644
index 0000000000000..e353de3616168
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_extent.h
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REMOVE_EXTENT_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H
+
+#include <__config>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent
+ {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]>
+ {typedef _Tp type;};
+template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]>
+ {typedef _Tp type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H
diff --git a/libcxx/include/__type_traits/remove_reference.h b/libcxx/include/__type_traits/remove_reference.h
new file mode 100644
index 0000000000000..a69e48dc584b0
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_reference.h
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REMOVE_REFERENCE_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
+
+#include <__config>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
diff --git a/libcxx/include/__type_traits/remove_volatile.h b/libcxx/include/__type_traits/remove_volatile.h
new file mode 100644
index 0000000000000..79f64c46a27d7
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_volatile.h
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_REMOVE_VOLATILE_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_VOLATILE_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_VOLATILE_H
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef
index 2a8b686bf3888..2b0659ab8ee7d 100644
--- a/libcxx/include/cstddef
+++ b/libcxx/include/cstddef
@@ -35,6 +35,7 @@ Types:
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__type_traits/is_integral.h>
#include <stddef.h>
#include <version>
@@ -52,34 +53,6 @@ using ::size_t _LIBCPP_USING_IF_EXISTS;
using ::max_align_t _LIBCPP_USING_IF_EXISTS;
#endif
-template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; };
-template <> struct __libcpp_is_integral<bool> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<char> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<signed char> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<unsigned char> { enum { value = 1 }; };
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; };
-#endif
-#ifndef _LIBCPP_HAS_NO_CHAR8_T
-template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; };
-#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; };
-#endif
-template <> struct __libcpp_is_integral<short> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<int> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<unsigned int> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<long> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<unsigned long> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<long long> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; };
-#ifndef _LIBCPP_HAS_NO_INT128
-template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; };
-template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; };
-#endif
-
_LIBCPP_END_NAMESPACE_STD
#if _LIBCPP_STD_VER > 14
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 87969556a0a72..d62e6ae4df47f 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -982,8 +982,33 @@ module std [system] {
export functional.__functional.unwrap_ref
export *
- module integral_constant { private header "__type_traits/integral_constant.h" }
- module is_callable { private header "__type_traits/is_callable.h" }
+ module add_pointer { private header "__type_traits/add_pointer.h" }
+ module conditional { private header "__type_traits/conditional.h" }
+ module decay { private header "__type_traits/decay.h" }
+ module enable_if { private header "__type_traits/enable_if.h" }
+ module integral_constant { private header "__type_traits/integral_constant.h" }
+ module is_array { private header "__type_traits/is_array.h" }
+ module is_base_of { private header "__type_traits/is_base_of.h" }
+ module is_callable { private header "__type_traits/is_callable.h" }
+ module is_const { private header "__type_traits/is_const.h" }
+ module is_convertible { private header "__type_traits/is_convertible.h" }
+ module is_floating_point { private header "__type_traits/is_floating_point.h" }
+ module is_function { private header "__type_traits/is_function.h" }
+ module is_integral { private header "__type_traits/is_integral.h" }
+ module is_member_function_pointer { private header "__type_traits/is_member_function_pointer.h" }
+ module is_member_object_pointer { private header "__type_traits/is_member_object_pointer.h" }
+ module is_null_pointer { private header "__type_traits/is_null_pointer.h" }
+ module is_reference { private header "__type_traits/is_reference.h" }
+ module is_reference_wrapper { private header "__type_traits/is_reference_wrapper.h" }
+ module is_referenceable { private header "__type_traits/is_referenceable.h" }
+ module is_same { private header "__type_traits/is_same.h" }
+ module is_void { private header "__type_traits/is_void.h" }
+ module is_volatile { private header "__type_traits/is_volatile.h" }
+ module remove_const { private header "__type_traits/remove_const.h" }
+ module remove_cv { private header "__type_traits/remove_cv.h" }
+ module remove_extent { private header "__type_traits/remove_extent.h" }
+ module remove_reference { private header "__type_traits/remove_reference.h" }
+ module remove_volatile { private header "__type_traits/remove_volatile.h" }
}
module typeindex {
header "typeindex"
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 9faa8d526aa70..b56f5395dd261 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -418,8 +418,33 @@ namespace std
*/
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__type_traits/add_pointer.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_base_of.h>
#include <__type_traits/is_callable.h>
+#include <__type_traits/is_const.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_floating_point.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_integral.h>
+#include <__type_traits/is_member_function_pointer.h>
+#include <__type_traits/is_member_object_pointer.h>
+#include <__type_traits/is_null_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_reference_wrapper.h>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/is_volatile.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_extent.h>
+#include <__type_traits/remove_reference.h>
+#include <__type_traits/remove_volatile.h>
#include <__utility/declval.h>
#include <cstddef>
#include <version>
@@ -431,18 +456,8 @@ namespace std
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
-template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
-
-template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;
-
-#if _LIBCPP_STD_VER > 11
-template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
-#endif
-
template <bool> struct _MetaBase;
template <>
struct _MetaBase<true> {
@@ -505,39 +520,8 @@ struct __void_t { typedef void type; };
template <class _Tp, bool>
struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};
-
-template <bool _Bp, class _If, class _Then>
- struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
-template <class _If, class _Then>
- struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;};
-
-#if _LIBCPP_STD_VER > 11
-template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
-#endif
-
// is_same
-template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp, class _Up>
-inline constexpr bool is_same_v = __is_same(_Tp, _Up);
-#endif
-
-// _IsSame<T,U> has the same effect as is_same<T,U> but instantiates fewer types:
-// is_same<A,B> and is_same<C,D> are guaranteed to be
diff erent types, but
-// _IsSame<A,B> and _IsSame<C,D> are the same type (namely, false_type).
-// Neither GCC nor Clang can mangle the __is_same builtin, so _IsSame
-// mustn't be directly used anywhere that contributes to name-mangling
-// (such as in a dependent return type).
-
-template <class _Tp, class _Up>
-using _IsSame = _BoolConstant<__is_same(_Tp, _Up)>;
-
-template <class _Tp, class _Up>
-using _IsNotSame = _BoolConstant<!__is_same(_Tp, _Up)>;
-
template <class _Tp>
using __test_for_primary_template = __enable_if_t<
_IsSame<_Tp, typename _Tp::__primary_template>::value
@@ -547,148 +531,8 @@ using __is_primary_template = _IsValidExpansion<
__test_for_primary_template, _Tp
>;
-// helper class
-
-struct __two {char __lx[2];};
-
-// is_const
-
-#if __has_keyword(__is_const)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_const_v = __is_const(_Tp);
-#endif
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_const_v = is_const<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_const)
-
-// is_volatile
-
-#if __has_keyword(__is_volatile)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_volatile_v = __is_volatile(_Tp);
-#endif
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_volatile)
-
-// remove_const
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;};
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
-#endif
-
-// remove_volatile
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
-#endif
-
-// remove_cv
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
-{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
-#endif
-
-// is_void
-
-#if __has_keyword(__is_void)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_void_v = __is_void(_Tp);
-#endif
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void
- : public is_same<typename remove_cv<_Tp>::type, void> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_void_v = is_void<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_void)
-
-// __is_nullptr_t
-
-template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
-template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t
- : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer
- : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
-#endif
-#endif // _LIBCPP_STD_VER > 11
-
// is_integral
-#if __has_keyword(__is_integral)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_integral_v = __is_integral(_Tp);
-#endif
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral
- : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_integral_v = is_integral<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_integral)
-
// [basic.fundamental] defines five standard signed integer types;
// __int128_t is an extended signed integer type.
// The signed and unsigned integer types, plus bool and the
@@ -714,52 +558,6 @@ template <> struct __libcpp_is_unsigned_integer<unsigned long long> : public tru
template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type {};
#endif
-// is_floating_point
-// <concepts> implements __libcpp_floating_point
-
-template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
-template <> struct __libcpp_is_floating_point<float> : public true_type {};
-template <> struct __libcpp_is_floating_point<double> : public true_type {};
-template <> struct __libcpp_is_floating_point<long double> : public true_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point
- : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
-#endif
-
-// is_array
-
-// TODO: Clang incorrectly reports that __is_array is true for T[0].
-// Re-enable the branch once https://llvm.org/PR54705 is fixed.
-#if __has_keyword(__is_array) && 0
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-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 > 14
-template <class _Tp>
-inline constexpr bool is_array_v = is_array<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_array)
-
// is_pointer
// Before AppleClang 12.0.5, __is_pointer didn't work for Objective-C types.
@@ -797,55 +595,6 @@ inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
#endif // __has_keyword(__is_pointer)
-// is_reference
-
-#if __has_keyword(__is_lvalue_reference) && \
- __has_keyword(__is_rvalue_reference) && \
- __has_keyword(__is_reference)
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { };
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_reference_v = __is_reference(_Tp);
-template <class _Tp>
-inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp);
-template <class _Tp>
-inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp);
-#endif
-
-#else // __has_keyword(__is_lvalue_reference) && etc...
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_reference_v = is_reference<_Tp>::value;
-
-template <class _Tp>
-inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
-
-template <class _Tp>
-inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_lvalue_reference) && etc...
-
// is_union
#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC)
@@ -891,61 +640,6 @@ template <class _Tp>
inline constexpr bool is_class_v = is_class<_Tp>::value;
#endif
-// is_function
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function
- : public _BoolConstant<
-#ifdef __clang__
- __is_function(_Tp)
-#else
- !(is_reference<_Tp>::value || is_const<const _Tp>::value)
-#endif
- > {};
-
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_function_v = is_function<_Tp>::value;
-#endif
-
-template <class _Tp> struct __libcpp_is_member_pointer {
- enum {
- __is_member = false,
- __is_func = false,
- __is_obj = false
- };
-};
-template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> {
- enum {
- __is_member = true,
- __is_func = is_function<_Tp>::value,
- __is_obj = !__is_func,
- };
-};
-
-#if __has_keyword(__is_member_function_pointer)
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
- : _BoolConstant<__is_member_function_pointer(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
-#endif
-
-#else // __has_keyword(__is_member_function_pointer)
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
- : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_member_function_pointer)
-
// is_member_pointer
#if __has_keyword(__is_member_pointer)
@@ -970,31 +664,6 @@ inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
#endif // __has_keyword(__is_member_pointer)
-// is_member_object_pointer
-
-#if __has_keyword(__is_member_object_pointer)
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
- : _BoolConstant<__is_member_object_pointer(_Tp)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
-#endif
-
-#else // __has_keyword(__is_member_object_pointer)
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
- : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value;
-#endif
-
-#endif // __has_keyword(__is_member_object_pointer)
-
// is_enum
#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC)
@@ -1159,18 +828,6 @@ inline constexpr bool is_compound_v = is_compound<_Tp>::value;
#endif // __has_keyword(__is_compound)
-// __is_referenceable [defns.referenceable]
-
-struct __is_referenceable_impl {
- template <class _Tp> static _Tp& __test(int);
- template <class _Tp> static __two __test(...);
-};
-
-template <class _Tp>
-struct __is_referenceable : integral_constant<bool,
- _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
-
-
// add_const
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const {
@@ -1200,16 +857,6 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv {
template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
#endif
-// remove_reference
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
-#endif
-
// add_lvalue_reference
template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; };
@@ -1275,21 +922,6 @@ template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type
// add_pointer
-template <class _Tp,
- bool = __is_referenceable<_Tp>::value ||
- _IsSame<typename remove_cv<_Tp>::type, void>::value>
-struct __add_pointer_impl
- {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;};
-template <class _Tp> struct __add_pointer_impl<_Tp, false>
- {typedef _LIBCPP_NODEBUG _Tp type;};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
- {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
-#endif
-
// type_identity
template <class _Tp>
@@ -1422,19 +1054,6 @@ inline constexpr size_t extent_v = extent<_Tp, _Ip>::value;
#endif // __has_keyword(__array_extent)
-// remove_extent
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent
- {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]>
- {typedef _Tp type;};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]>
- {typedef _Tp type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;
-#endif
-
// remove_all_extents
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents
@@ -1468,42 +1087,6 @@ inline constexpr
bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
#endif
-// decay
-
-template <class _Up, bool>
-struct __decay {
- typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type;
-};
-
-template <class _Up>
-struct __decay<_Up, true> {
-public:
- typedef _LIBCPP_NODEBUG typename conditional
- <
- is_array<_Up>::value,
- typename remove_extent<_Up>::type*,
- typename conditional
- <
- is_function<_Up>::value,
- typename add_pointer<_Up>::type,
- typename remove_cv<_Up>::type
- >::type
- >::type type;
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS decay
-{
-private:
- typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up;
-public:
- typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
-};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using decay_t = typename decay<_Tp>::type;
-#endif
-
// is_abstract
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
@@ -1540,17 +1123,6 @@ inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
#endif // _LIBCPP_STD_VER > 14
-// is_base_of
-
-template <class _Bp, class _Dp>
-struct _LIBCPP_TEMPLATE_VIS is_base_of
- : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Bp, class _Dp>
-inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value;
-#endif
-
// __is_core_convertible
// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed.
@@ -1566,87 +1138,6 @@ struct __is_core_convertible<_Tp, _Up, decltype(
static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() )
)> : public true_type {};
-// is_convertible
-
-#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
-
-template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
- : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
-
-#else // __has_feature(is_convertible_to)
-
-namespace __is_convertible_imp
-{
-template <class _Tp> void __test_convert(_Tp);
-
-template <class _From, class _To, class = void>
-struct __is_convertible_test : public false_type {};
-
-template <class _From, class _To>
-struct __is_convertible_test<_From, _To,
- decltype(__is_convertible_imp::__test_convert<_To>(declval<_From>()))> : public true_type
-{};
-
-template <class _Tp, bool _IsArray = is_array<_Tp>::value,
- bool _IsFunction = is_function<_Tp>::value,
- bool _IsVoid = is_void<_Tp>::value>
- struct __is_array_function_or_void {enum {value = 0};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
-}
-
-template <class _Tp,
- unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value>
-struct __is_convertible_check
-{
- static const size_t __v = 0;
-};
-
-template <class _Tp>
-struct __is_convertible_check<_Tp, 0>
-{
- static const size_t __v = sizeof(_Tp);
-};
-
-template <class _T1, class _T2,
- unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
- unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
-struct __is_convertible
- : public integral_constant<bool,
- __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
- >
-{};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
-
-template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
- : public __is_convertible<_T1, _T2>
-{
- static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
- static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
-};
-
-#endif // __has_feature(is_convertible_to)
-
-#if _LIBCPP_STD_VER > 14
-template <class _From, class _To>
-inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
-#endif
-
// is_nothrow_convertible
#if _LIBCPP_STD_VER > 17
@@ -3349,10 +2840,6 @@ template <class _Tp>
inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
#endif
-template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
-template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
-template <class _Tp> struct __is_reference_wrapper
- : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
#ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp
index 057aaa4e11ad9..d85a7e99fa81f 100644
--- a/libcxx/test/libcxx/private_headers.verify.cpp
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -441,8 +441,33 @@ END-SCRIPT
#include <__thread/poll_with_backoff.h> // expected-error@*:* {{use of private header from outside its module: '__thread/poll_with_backoff.h'}}
#include <__thread/timed_backoff_policy.h> // expected-error@*:* {{use of private header from outside its module: '__thread/timed_backoff_policy.h'}}
#include <__tuple> // expected-error@*:* {{use of private header from outside its module: '__tuple'}}
+#include <__type_traits/add_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_pointer.h'}}
+#include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}}
+#include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}}
+#include <__type_traits/enable_if.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/enable_if.h'}}
#include <__type_traits/integral_constant.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/integral_constant.h'}}
+#include <__type_traits/is_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_array.h'}}
+#include <__type_traits/is_base_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_base_of.h'}}
#include <__type_traits/is_callable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_callable.h'}}
+#include <__type_traits/is_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_const.h'}}
+#include <__type_traits/is_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_convertible.h'}}
+#include <__type_traits/is_floating_point.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_floating_point.h'}}
+#include <__type_traits/is_function.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_function.h'}}
+#include <__type_traits/is_integral.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_integral.h'}}
+#include <__type_traits/is_member_function_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_function_pointer.h'}}
+#include <__type_traits/is_member_object_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_object_pointer.h'}}
+#include <__type_traits/is_null_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_null_pointer.h'}}
+#include <__type_traits/is_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference.h'}}
+#include <__type_traits/is_reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference_wrapper.h'}}
+#include <__type_traits/is_referenceable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_referenceable.h'}}
+#include <__type_traits/is_same.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_same.h'}}
+#include <__type_traits/is_void.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_void.h'}}
+#include <__type_traits/is_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_volatile.h'}}
+#include <__type_traits/remove_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const.h'}}
+#include <__type_traits/remove_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cv.h'}}
+#include <__type_traits/remove_extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_extent.h'}}
+#include <__type_traits/remove_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_reference.h'}}
+#include <__type_traits/remove_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_volatile.h'}}
#include <__utility/as_const.h> // expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}}
#include <__utility/auto_cast.h> // expected-error@*:* {{use of private header from outside its module: '__utility/auto_cast.h'}}
#include <__utility/cmp.h> // expected-error@*:* {{use of private header from outside its module: '__utility/cmp.h'}}
More information about the libcxx-commits
mailing list