[libcxx-commits] [libcxx] 1972d1e - [libc++] Granularize even more of type_traits
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 10 02:56:43 PDT 2022
Author: Nikolas Klauser
Date: 2022-06-10T11:56:38+02:00
New Revision: 1972d1e86a62dd9a8c39f82d1dc3b5d0a75d2422
URL: https://github.com/llvm/llvm-project/commit/1972d1e86a62dd9a8c39f82d1dc3b5d0a75d2422
DIFF: https://github.com/llvm/llvm-project/commit/1972d1e86a62dd9a8c39f82d1dc3b5d0a75d2422.diff
LOG: [libc++] Granularize even more of type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D126593
Added:
libcxx/include/__type_traits/alignment_of.h
libcxx/include/__type_traits/apply_cv.h
libcxx/include/__type_traits/has_unique_object_representation.h
libcxx/include/__type_traits/has_virtual_destructor.h
libcxx/include/__type_traits/is_assignable.h
libcxx/include/__type_traits/is_constant_evaluated.h
libcxx/include/__type_traits/is_copy_assignable.h
libcxx/include/__type_traits/is_core_convertible.h
libcxx/include/__type_traits/is_literal_type.h
libcxx/include/__type_traits/is_move_assignable.h
libcxx/include/__type_traits/is_pod.h
libcxx/include/__type_traits/is_polymorphic.h
libcxx/include/__type_traits/is_scoped_enum.h
libcxx/include/__type_traits/is_standard_layout.h
libcxx/include/__type_traits/is_trivial.h
libcxx/include/__type_traits/is_trivially_copyable.h
libcxx/include/__type_traits/underlying_type.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/__functional/invoke.h
libcxx/include/__functional/weak_result_type.h
libcxx/include/__utility/forward.h
libcxx/include/module.modulemap.in
libcxx/include/type_traits
libcxx/include/utility
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index d5ed8d1f97d60..160ebeb693d6a 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -456,24 +456,32 @@ set(files
__type_traits/add_pointer.h
__type_traits/add_rvalue_reference.h
__type_traits/add_volatile.h
+ __type_traits/alignment_of.h
+ __type_traits/apply_cv.h
__type_traits/conditional.h
__type_traits/conjunction.h
__type_traits/decay.h
__type_traits/disjunction.h
__type_traits/enable_if.h
__type_traits/extent.h
+ __type_traits/has_unique_object_representation.h
+ __type_traits/has_virtual_destructor.h
__type_traits/integral_constant.h
__type_traits/is_abstract.h
__type_traits/is_aggregate.h
__type_traits/is_arithmetic.h
__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_class.h
__type_traits/is_compound.h
__type_traits/is_const.h
+ __type_traits/is_constant_evaluated.h
__type_traits/is_convertible.h
+ __type_traits/is_copy_assignable.h
+ __type_traits/is_core_convertible.h
__type_traits/is_empty.h
__type_traits/is_enum.h
__type_traits/is_final.h
@@ -481,18 +489,26 @@ set(files
__type_traits/is_function.h
__type_traits/is_fundamental.h
__type_traits/is_integral.h
+ __type_traits/is_literal_type.h
__type_traits/is_member_function_pointer.h
__type_traits/is_member_object_pointer.h
__type_traits/is_member_pointer.h
+ __type_traits/is_move_assignable.h
__type_traits/is_null_pointer.h
__type_traits/is_object.h
+ __type_traits/is_pod.h
__type_traits/is_pointer.h
+ __type_traits/is_polymorphic.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_scalar.h
+ __type_traits/is_scoped_enum.h
__type_traits/is_signed.h
+ __type_traits/is_standard_layout.h
+ __type_traits/is_trivial.h
+ __type_traits/is_trivially_copyable.h
__type_traits/is_unbounded_array.h
__type_traits/is_union.h
__type_traits/is_unsigned.h
@@ -507,6 +523,7 @@ set(files
__type_traits/remove_reference.h
__type_traits/remove_volatile.h
__type_traits/type_identity.h
+ __type_traits/underlying_type.h
__undef_macros
__utility/as_const.h
__utility/auto_cast.h
diff --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h
index b4c3e76562a86..52c29a4323e88 100644
--- a/libcxx/include/__functional/invoke.h
+++ b/libcxx/include/__functional/invoke.h
@@ -11,16 +11,649 @@
#define _LIBCPP___FUNCTIONAL_INVOKE_H
#include <__config>
-#include <__functional/weak_result_type.h>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/apply_cv.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_base_of.h>
+#include <__type_traits/is_core_convertible.h>
+#include <__type_traits/is_member_function_pointer.h>
+#include <__type_traits/is_member_object_pointer.h>
+#include <__type_traits/is_reference_wrapper.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/remove_cv.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
+// TODO: Disentangle the type traits and std::invoke properly
+
_LIBCPP_BEGIN_NAMESPACE_STD
+struct __any
+{
+ __any(...);
+};
+
+struct __nat
+{
+#ifndef _LIBCPP_CXX03_LANG
+ __nat() = delete;
+ __nat(const __nat&) = delete;
+ __nat& operator=(const __nat&) = delete;
+ ~__nat() = delete;
+#endif
+};
+
+template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
+struct __member_pointer_traits_imp
+{
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
+{
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
+{
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
+{
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
+{
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
+{
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
+{
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
+{
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
+{
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
+{
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
+{
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
+{
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
+{
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
+{
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
+{
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
+{
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
+{
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
+{
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
+{
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
+{
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
+{
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
+{
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
+{
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp (_FnType) (_Param..., ...);
+};
+
+#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
+
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
+{
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+};
+
+template <class _MP>
+struct __member_pointer_traits
+ : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
+ is_member_function_pointer<_MP>::value,
+ is_member_object_pointer<_MP>::value>
+{
+// typedef ... _ClassType;
+// typedef ... _ReturnType;
+// typedef ... _FnType;
+};
+
+template <class _DecayedFp>
+struct __member_pointer_class_type {};
+
+template <class _Ret, class _ClassType>
+struct __member_pointer_class_type<_Ret _ClassType::*> {
+ typedef _ClassType type;
+};
+
+#ifndef _LIBCPP_CXX03_LANG
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet1 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && is_base_of<_ClassT, _DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type>
+using __enable_if_bullet2 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && __is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet3 = typename enable_if
+ <
+ is_member_function_pointer<_DecayFp>::value
+ && !is_base_of<_ClassT, _DecayA0>::value
+ && !__is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet4 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && is_base_of<_ClassT, _DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type>
+using __enable_if_bullet5 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && __is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+template <class _Fp, class _A0,
+ class _DecayFp = typename decay<_Fp>::type,
+ class _DecayA0 = typename decay<_A0>::type,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet6 = typename enable_if
+ <
+ is_member_object_pointer<_DecayFp>::value
+ && !is_base_of<_ClassT, _DecayA0>::value
+ && !__is_reference_wrapper<_DecayA0>::value
+ >::type;
+
+// __invoke forward declarations
+
+// fall back - none of the bullets
+
+template <class ..._Args>
+auto __invoke(__any, _Args&& ...__args) -> __nat;
+
+// bullets 1, 2 and 3
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet1<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
+ -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))
+ { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet2<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
+ -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...))
+ { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }
+
+template <class _Fp, class _A0, class ..._Args,
+ class = __enable_if_bullet3<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+ noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
+ -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))
+ { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); }
+
+// bullets 4, 5 and 6
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet4<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0)
+ noexcept(noexcept(static_cast<_A0&&>(__a0).*__f))
+ -> decltype( static_cast<_A0&&>(__a0).*__f)
+ { return static_cast<_A0&&>(__a0).*__f; }
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet5<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0)
+ noexcept(noexcept(__a0.get().*__f))
+ -> decltype( __a0.get().*__f)
+ { return __a0.get().*__f; }
+
+template <class _Fp, class _A0,
+ class = __enable_if_bullet6<_Fp, _A0>>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _A0&& __a0)
+ noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f))
+ -> decltype( (*static_cast<_A0&&>(__a0)).*__f)
+ { return (*static_cast<_A0&&>(__a0)).*__f; }
+
+// bullet 7
+
+template <class _Fp, class ..._Args>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr auto
+__invoke(_Fp&& __f, _Args&& ...__args)
+ noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
+ -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))
+ { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
+
+// __invokable
+template <class _Ret, class _Fp, class ..._Args>
+struct __invokable_r
+{
+ template <class _XFp, class ..._XArgs>
+ static auto __try_call(int) -> decltype(
+ _VSTD::__invoke(declval<_XFp>(), declval<_XArgs>()...));
+ template <class _XFp, class ..._XArgs>
+ static __nat __try_call(...);
+
+ // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
+ // or incomplete array types as required by the standard.
+ using _Result = decltype(__try_call<_Fp, _Args...>(0));
+
+ using type = typename conditional<
+ _IsNotSame<_Result, __nat>::value,
+ typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type,
+ false_type >::type;
+ static const bool value = type::value;
+};
+template <class _Fp, class ..._Args>
+using __invokable = __invokable_r<void, _Fp, _Args...>;
+
+template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp {
+ static const bool value = false;
+};
+
+template <class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
+{
+ typedef __nothrow_invokable_r_imp _ThisT;
+
+ template <class _Tp>
+ static void __test_noexcept(_Tp) noexcept;
+
+ static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(
+ _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)));
+};
+
+template <class _Ret, class _Fp, class ..._Args>
+struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
+{
+ static const bool value = noexcept(
+ _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...));
+};
+
+template <class _Ret, class _Fp, class ..._Args>
+using __nothrow_invokable_r =
+ __nothrow_invokable_r_imp<
+ __invokable_r<_Ret, _Fp, _Args...>::value,
+ is_void<_Ret>::value,
+ _Ret, _Fp, _Args...
+ >;
+
+template <class _Fp, class ..._Args>
+using __nothrow_invokable =
+ __nothrow_invokable_r_imp<
+ __invokable<_Fp, _Args...>::value,
+ true, void, _Fp, _Args...
+ >;
+
+template <class _Fp, class ..._Args>
+struct __invoke_of
+ : public enable_if<
+ __invokable<_Fp, _Args...>::value,
+ typename __invokable_r<void, _Fp, _Args...>::_Result>
+{
+};
+
+#else
+
+// Assume that it's a functor in C++03
+template <class _Func, class... _Args>
+_LIBCPP_HIDE_FROM_ABI
+decltype(std::declval<_Func>()(std::declval<_Args>()...)) __invoke(_Func&& __func, _Args&&... __args) {
+ return static_cast<_Func&&>(__func)(static_cast<_Args&&>(__args)...);
+}
+
+template <class _Ret, class _T1, bool _IsFunc, bool _IsBase>
+struct __enable_invoke_imp;
+
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, true, true> {
+ typedef _Ret _Bullet1;
+ typedef _Bullet1 type;
+};
+
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, true, false> {
+ typedef _Ret _Bullet2;
+ typedef _Bullet2 type;
+};
+
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, false, true> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<_T1, _Ret>::type
+ >::type _Bullet3;
+ typedef _Bullet3 type;
+};
+
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, false, false> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
+ >::type _Bullet4;
+ typedef _Bullet4 type;
+};
+
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1*, false, false> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<_T1, _Ret>::type
+ >::type _Bullet4;
+ typedef _Bullet4 type;
+};
+
+template <class _Fn, class _T1,
+ class _Traits = __member_pointer_traits<_Fn>,
+ class _Ret = typename _Traits::_ReturnType,
+ class _Class = typename _Traits::_ClassType>
+struct __enable_invoke : __enable_invoke_imp<
+ _Ret, _T1,
+ is_member_function_pointer<_Fn>::value,
+ is_base_of<_Class, typename remove_reference<_T1>::type>::value>
+{
+};
+
+__nat __invoke(__any, ...);
+
+// first bullet
+
+template <class _Fn, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1) {
+ return (__t1.*__f)();
+}
+
+template <class _Fn, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
+ return (__t1.*__f)(__a0);
+}
+
+template <class _Fn, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
+ return (__t1.*__f)(__a0, __a1);
+}
+
+template <class _Fn, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
+ return (__t1.*__f)(__a0, __a1, __a2);
+}
+
+template <class _Fn, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1) {
+ return ((*__t1).*__f)();
+}
+
+template <class _Fn, class _T1, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
+ return ((*__t1).*__f)(__a0);
+}
+
+template <class _Fn, class _T1, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
+ return ((*__t1).*__f)(__a0, __a1);
+}
+
+template <class _Fn, class _T1, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
+ return ((*__t1).*__f)(__a0, __a1, __a2);
+}
+
+template <class _Fn, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet3
+__invoke(_Fn __f, _T1& __t1) {
+ return __t1.*__f;
+}
+
+template <class _Fn, class _T1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename __enable_invoke<_Fn, _T1>::_Bullet4
+__invoke(_Fn __f, _T1& __t1) {
+ return (*__t1).*__f;
+}
+
+// fifth bullet
+
+template <class _Fp>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(declval<_Fp&>()())
+__invoke(_Fp& __f)
+{
+ return __f();
+}
+
+template <class _Fp, class _A0>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(declval<_Fp&>()(declval<_A0&>()))
+__invoke(_Fp& __f, _A0& __a0)
+{
+ return __f(__a0);
+}
+
+template <class _Fp, class _A0, class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
+{
+ return __f(__a0, __a1);
+}
+
+template <class _Fp, class _A0, class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
+{
+ return __f(__a0, __a1, __a2);
+}
+
+#endif // _LIBCPP_CXX03_LANG
+
template <class _Ret, bool = is_void<_Ret>::value>
struct __invoke_void_return_wrapper
{
@@ -85,6 +718,47 @@ struct __invoke_void_return_wrapper<_Ret, true>
#if _LIBCPP_STD_VER > 14
+// is_invocable
+
+template <class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable
+ : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};
+
+template <class _Ret, class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable_r
+ : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {};
+
+template <class _Fn, class ..._Args>
+inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
+
+template <class _Ret, class _Fn, class ..._Args>
+inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value;
+
+// is_nothrow_invocable
+
+template <class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable
+ : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {};
+
+template <class _Ret, class _Fn, class ..._Args>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r
+ : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {};
+
+template <class _Fn, class ..._Args>
+inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value;
+
+template <class _Ret, class _Fn, class ..._Args>
+inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
+
+template <class _Fn, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS invoke_result
+ : __invoke_of<_Fn, _Args...>
+{
+};
+
+template <class _Fn, class... _Args>
+using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
+
template <class _Fn, class ..._Args>
_LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...>
invoke(_Fn&& __f, _Args&&... __args)
diff --git a/libcxx/include/__functional/weak_result_type.h b/libcxx/include/__functional/weak_result_type.h
index e1c553e6f0cdb..32484c34b6943 100644
--- a/libcxx/include/__functional/weak_result_type.h
+++ b/libcxx/include/__functional/weak_result_type.h
@@ -265,165 +265,7 @@ struct __invoke_return
typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
};
-#else // defined(_LIBCPP_CXX03_LANG)
-
-template <class _Ret, class _T1, bool _IsFunc, bool _IsBase>
-struct __enable_invoke_imp;
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, true, true> {
- typedef _Ret _Bullet1;
- typedef _Bullet1 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, true, false> {
- typedef _Ret _Bullet2;
- typedef _Bullet2 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, false, true> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<_T1, _Ret>::type
- >::type _Bullet3;
- typedef _Bullet3 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1, false, false> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
- >::type _Bullet4;
- typedef _Bullet4 type;
-};
-
-template <class _Ret, class _T1>
-struct __enable_invoke_imp<_Ret, _T1*, false, false> {
- typedef typename add_lvalue_reference<
- typename __apply_cv<_T1, _Ret>::type
- >::type _Bullet4;
- typedef _Bullet4 type;
-};
-
-template <class _Fn, class _T1,
- class _Traits = __member_pointer_traits<_Fn>,
- class _Ret = typename _Traits::_ReturnType,
- class _Class = typename _Traits::_ClassType>
-struct __enable_invoke : __enable_invoke_imp<
- _Ret, _T1,
- is_member_function_pointer<_Fn>::value,
- is_base_of<_Class, typename remove_reference<_T1>::type>::value>
-{
-};
-
-__nat __invoke(__any, ...);
-
-// first bullet
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1) {
- return (__t1.*__f)();
-}
-
-template <class _Fn, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
- return (__t1.*__f)(__a0);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
- return (__t1.*__f)(__a0, __a1);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet1
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
- return (__t1.*__f)(__a0, __a1, __a2);
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1) {
- return ((*__t1).*__f)();
-}
-
-template <class _Fn, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
- return ((*__t1).*__f)(__a0);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
- return ((*__t1).*__f)(__a0, __a1);
-}
-
-template <class _Fn, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet2
-__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
- return ((*__t1).*__f)(__a0, __a1, __a2);
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet3
-__invoke(_Fn __f, _T1& __t1) {
- return __t1.*__f;
-}
-
-template <class _Fn, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __enable_invoke<_Fn, _T1>::_Bullet4
-__invoke(_Fn __f, _T1& __t1) {
- return (*__t1).*__f;
-}
-
-// fifth bullet
-
-template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()())
-__invoke(_Fp& __f)
-{
- return __f();
-}
-
-template <class _Fp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>()))
-__invoke(_Fp& __f, _A0& __a0)
-{
- return __f(__a0);
-}
-
-template <class _Fp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
-__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
-{
- return __f(__a0, __a1);
-}
-
-template <class _Fp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
-__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return __f(__a0, __a1, __a2);
-}
+#else
template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
struct __invoke_return
diff --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h
new file mode 100644
index 0000000000000..65c603058ffae
--- /dev/null
+++ b/libcxx/include/__type_traits/alignment_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_ALIGNMENT_OF_H
+#define _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_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
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of
+ : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H
diff --git a/libcxx/include/__type_traits/apply_cv.h b/libcxx/include/__type_traits/apply_cv.h
new file mode 100644
index 0000000000000..4a5aab48a7230
--- /dev/null
+++ b/libcxx/include/__type_traits/apply_cv.h
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_APPLY_CV_H
+#define _LIBCPP___TYPE_TRAITS_APPLY_CV_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_const.h>
+#include <__type_traits/is_volatile.h>
+#include <__type_traits/remove_reference.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
+ bool = is_volatile<typename remove_reference<_Tp>::type>::value>
+struct __apply_cv
+{
+ typedef _LIBCPP_NODEBUG _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, true, false>
+{
+ typedef _LIBCPP_NODEBUG const _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, false, true>
+{
+ typedef volatile _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp, _Up, true, true>
+{
+ typedef const volatile _Up type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, false, false>
+{
+ typedef _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, true, false>
+{
+ typedef const _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, false, true>
+{
+ typedef volatile _Up& type;
+};
+
+template <class _Tp, class _Up>
+struct __apply_cv<_Tp&, _Up, true, true>
+{
+ typedef const volatile _Up& type;
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_APPLY_CV_H
diff --git a/libcxx/include/__type_traits/has_unique_object_representation.h b/libcxx/include/__type_traits/has_unique_object_representation.h
new file mode 100644
index 0000000000000..d6f75c9ce5c9c
--- /dev/null
+++ b/libcxx/include/__type_traits/has_unique_object_representation.h
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_HAS_UNIQUE_OBJECT_REPRESENTATION_H
+#define _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_all_extents.h>
+#include <__type_traits/remove_cv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 14
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
+ : public integral_constant<bool,
+ __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {};
+
+template <class _Tp>
+inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value;
+
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
diff --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h
new file mode 100644
index 0000000000000..33574373632e8
--- /dev/null
+++ b/libcxx/include/__type_traits/has_virtual_destructor.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_HAS_VIRTUAL_DESTRUCTOR_H
+#define _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_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_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC)
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
+ : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
+ : public false_type {};
+
+#endif
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H
diff --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h
new file mode 100644
index 0000000000000..edc864cae0659
--- /dev/null
+++ b/libcxx/include/__type_traits/is_assignable.h
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_ASSIGNABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_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<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; };
+
+#if __has_keyword(__is_assignable)
+
+template<class _Tp, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { };
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp, class _Arg>
+inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg);
+#endif
+
+#else // __has_keyword(__is_assignable)
+
+template <class _Tp, class _Arg>
+typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type
+__is_assignable_test(int);
+
+template <class, class>
+false_type __is_assignable_test(...);
+
+
+template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
+struct __is_assignable_imp
+ : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {};
+
+template <class _Tp, class _Arg>
+struct __is_assignable_imp<_Tp, _Arg, true>
+ : public false_type
+{
+};
+
+template <class _Tp, class _Arg>
+struct is_assignable
+ : public __is_assignable_imp<_Tp, _Arg> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp, class _Arg>
+inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value;
+#endif
+
+#endif // __has_keyword(__is_assignable)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H
diff --git a/libcxx/include/__type_traits/is_constant_evaluated.h b/libcxx/include/__type_traits/is_constant_evaluated.h
new file mode 100644
index 0000000000000..de5ff6c43f407
--- /dev/null
+++ b/libcxx/include/__type_traits/is_constant_evaluated.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_CONSTANT_EVALUATED_H
+#define _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 17
+_LIBCPP_INLINE_VISIBILITY
+inline constexpr bool is_constant_evaluated() noexcept {
+ return __builtin_is_constant_evaluated();
+}
+#endif
+
+inline _LIBCPP_CONSTEXPR
+bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H
diff --git a/libcxx/include/__type_traits/is_copy_assignable.h b/libcxx/include/__type_traits/is_copy_assignable.h
new file mode 100644
index 0000000000000..e46b1249459ed
--- /dev/null
+++ b/libcxx/include/__type_traits/is_copy_assignable.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_COPY_ASSIGNABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
+
+#include <__config>
+#include <__type_traits/add_const.h>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_assignable.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_copy_assignable
+ : public is_assignable<typename add_lvalue_reference<_Tp>::type,
+ typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
diff --git a/libcxx/include/__type_traits/is_core_convertible.h b/libcxx/include/__type_traits/is_core_convertible.h
new file mode 100644
index 0000000000000..1ce4079130524
--- /dev/null
+++ b/libcxx/include/__type_traits/is_core_convertible.h
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CORE_CONVERTIBLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_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
+
+// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed.
+// We can't test for that, but we can test implicit convertibility by passing it
+// to a function. Notice that __is_core_convertible<void,void> is false,
+// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later.
+
+template <class _Tp, class _Up, class = void>
+struct __is_core_convertible : public false_type {};
+
+template <class _Tp, class _Up>
+struct __is_core_convertible<_Tp, _Up, decltype(
+ static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() )
+)> : public true_type {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_H
diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h
new file mode 100644
index 0000000000000..df525ecee208d
--- /dev/null
+++ b/libcxx/include/__type_traits/is_literal_type.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_IS_LITERAL_TYPE
+#define _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE
+
+#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 _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type
+ : public integral_constant<bool, __is_literal_type(_Tp)>
+ {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
+#endif // _LIBCPP_STD_VER > 14
+#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE
diff --git a/libcxx/include/__type_traits/is_move_assignable.h b/libcxx/include/__type_traits/is_move_assignable.h
new file mode 100644
index 0000000000000..1e8aa23bea378
--- /dev/null
+++ b/libcxx/include/__type_traits/is_move_assignable.h
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_MOVE_ASSIGNABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H
+
+#include <__config>
+#include <__type_traits/add_const.h>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/add_rvalue_reference.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_assignable.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_move_assignable
+ : public is_assignable<typename add_lvalue_reference<_Tp>::type,
+ typename add_rvalue_reference<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H
diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h
new file mode 100644
index 0000000000000..4317182f89643
--- /dev/null
+++ b/libcxx/include/__type_traits/is_pod.h
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_POD_H
+#define _LIBCPP___TYPE_TRAITS_IS_POD_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_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC)
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
+ : public integral_constant<bool, __is_pod(_Tp)> {};
+
+#else
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
+ : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value &&
+ is_trivially_copy_constructible<_Tp>::value &&
+ is_trivially_copy_assignable<_Tp>::value &&
+ is_trivially_destructible<_Tp>::value> {};
+
+#endif
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_pod_v = is_pod<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_POD_H
diff --git a/libcxx/include/__type_traits/is_polymorphic.h b/libcxx/include/__type_traits/is_polymorphic.h
new file mode 100644
index 0000000000000..cca7260d04d3f
--- /dev/null
+++ b/libcxx/include/__type_traits/is_polymorphic.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_POLYMORPHIC_H
+#define _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_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_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_polymorphic
+ : public integral_constant<bool, __is_polymorphic(_Tp)> {};
+
+#else
+
+template<typename _Tp> char &__is_polymorphic_impl(
+ typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
+ int>::type);
+template<typename _Tp> __two &__is_polymorphic_impl(...);
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_polymorphic
+ : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};
+
+#endif // __has_feature(is_polymorphic)
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_H
diff --git a/libcxx/include/__type_traits/is_scoped_enum.h b/libcxx/include/__type_traits/is_scoped_enum.h
new file mode 100644
index 0000000000000..85a4128133043
--- /dev/null
+++ b/libcxx/include/__type_traits/is_scoped_enum.h
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_SCOPED_ENUM_H
+#define _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_enum.h>
+#include <__type_traits/underlying_type.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER > 20
+template <class _Tp, bool = is_enum_v<_Tp> >
+struct __is_scoped_enum_helper : false_type {};
+
+template <class _Tp>
+struct __is_scoped_enum_helper<_Tp, true>
+ : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_scoped_enum
+ : public __is_scoped_enum_helper<_Tp> {};
+
+template <class _Tp>
+inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H
diff --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h
new file mode 100644
index 0000000000000..375d08721e90b
--- /dev/null
+++ b/libcxx/include/__type_traits/is_standard_layout.h
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_STANDARD_LAYOUT_H
+#define _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_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> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
+#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC)
+ : public integral_constant<bool, __is_standard_layout(_Tp)>
+#else
+ : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
+#endif
+ {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_H
diff --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h
new file mode 100644
index 0000000000000..011963c3d0e6d
--- /dev/null
+++ b/libcxx/include/__type_traits/is_trivial.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_TRIVIAL_H
+#define _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_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> struct _LIBCPP_TEMPLATE_VIS is_trivial
+#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC)
+ : public integral_constant<bool, __is_trivial(_Tp)>
+#else
+ : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
+ is_trivially_default_constructible<_Tp>::value>
+#endif
+ {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_H
diff --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h
new file mode 100644
index 0000000000000..3b7665217292f
--- /dev/null
+++ b/libcxx/include/__type_traits/is_trivially_copyable.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_TRIVIALLY_COPYABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_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> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable
+ : public integral_constant<bool, __is_trivially_copyable(_Tp)>
+ {};
+
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H
diff --git a/libcxx/include/__type_traits/underlying_type.h b/libcxx/include/__type_traits/underlying_type.h
new file mode 100644
index 0000000000000..1c8db64323715
--- /dev/null
+++ b/libcxx/include/__type_traits/underlying_type.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_UNDERLYING_TYPE_H
+#define _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H
+
+#include <__config>
+#include <__type_traits/is_enum.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl;
+
+template <class _Tp>
+struct __underlying_type_impl<_Tp, false> {};
+
+template <class _Tp>
+struct __underlying_type_impl<_Tp, true>
+{
+ typedef __underlying_type(_Tp) type;
+};
+
+template <class _Tp>
+struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H
diff --git a/libcxx/include/__utility/forward.h b/libcxx/include/__utility/forward.h
index 6ee1f818baca3..03ca16d9f9553 100644
--- a/libcxx/include/__utility/forward.h
+++ b/libcxx/include/__utility/forward.h
@@ -11,7 +11,8 @@
#define _LIBCPP___UTILITY_FORWARD_H
#include <__config>
-#include <type_traits>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_reference.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 1fbf883f7168d..f146703e54301 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1029,63 +1029,80 @@ module std [system] {
export functional.__functional.unwrap_ref
export *
- module add_const { private header "__type_traits/add_const.h" }
- module add_cv { private header "__type_traits/add_cv.h" }
- module add_lvalue_reference { private header "__type_traits/add_lvalue_reference.h" }
- module add_pointer { private header "__type_traits/add_pointer.h" }
- module add_rvalue_reference { private header "__type_traits/add_rvalue_reference.h" }
- module add_volatile { private header "__type_traits/add_volatile.h" }
- module conditional { private header "__type_traits/conditional.h" }
- module conjunction { private header "__type_traits/conjunction.h" }
- module decay { private header "__type_traits/decay.h" }
- module disjunction { private header "__type_traits/disjunction.h" }
- module enable_if { private header "__type_traits/enable_if.h" }
- module extent { private header "__type_traits/extent.h" }
- module integral_constant { private header "__type_traits/integral_constant.h" }
- module is_abstract { private header "__type_traits/is_abstract.h" }
- module is_aggregate { private header "__type_traits/is_aggregate.h" }
- module is_arithmetic { private header "__type_traits/is_arithmetic.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_bounded_array { private header "__type_traits/is_bounded_array.h" }
- module is_callable { private header "__type_traits/is_callable.h" }
- module is_class { private header "__type_traits/is_class.h" }
- module is_compound { private header "__type_traits/is_compound.h" }
- module is_const { private header "__type_traits/is_const.h" }
- module is_convertible { private header "__type_traits/is_convertible.h" }
- module is_empty { private header "__type_traits/is_empty.h" }
- module is_enum { private header "__type_traits/is_enum.h" }
- module is_final { private header "__type_traits/is_final.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_fundamental { private header "__type_traits/is_fundamental.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_member_pointer { private header "__type_traits/is_member_pointer.h" }
- module is_null_pointer { private header "__type_traits/is_null_pointer.h" }
- module is_object { private header "__type_traits/is_object.h" }
- module is_pointer { private header "__type_traits/is_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_scalar { private header "__type_traits/is_scalar.h" }
- module is_signed { private header "__type_traits/is_signed.h" }
- module is_unbounded_array { private header "__type_traits/is_unbounded_array.h" }
- module is_union { private header "__type_traits/is_union.h" }
- module is_unsigned { private header "__type_traits/is_unsigned.h" }
- module is_void { private header "__type_traits/is_void.h" }
- module is_volatile { private header "__type_traits/is_volatile.h" }
- module rank { private header "__type_traits/rank.h" }
- module remove_all_extents { private header "__type_traits/remove_all_extents.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_pointer { private header "__type_traits/remove_pointer.h" }
- module remove_reference { private header "__type_traits/remove_reference.h" }
- module remove_volatile { private header "__type_traits/remove_volatile.h" }
- module type_identity { private header "__type_traits/type_identity.h" }
+ module add_const { private header "__type_traits/add_const.h" }
+ module add_cv { private header "__type_traits/add_cv.h" }
+ module add_lvalue_reference { private header "__type_traits/add_lvalue_reference.h" }
+ module add_pointer { private header "__type_traits/add_pointer.h" }
+ module add_rvalue_reference { private header "__type_traits/add_rvalue_reference.h" }
+ module add_volatile { private header "__type_traits/add_volatile.h" }
+ module alignment_of { private header "__type_traits/alignment_of.h" }
+ module apply_cv { private header "__type_traits/apply_cv.h" }
+ module conditional { private header "__type_traits/conditional.h" }
+ module conjunction { private header "__type_traits/conjunction.h" }
+ module decay { private header "__type_traits/decay.h" }
+ module disjunction { private header "__type_traits/disjunction.h" }
+ module enable_if { private header "__type_traits/enable_if.h" }
+ module extent { private header "__type_traits/extent.h" }
+ module has_unique_object_representation { private header "__type_traits/has_unique_object_representation.h" }
+ module has_virtual_destructor { private header "__type_traits/has_virtual_destructor.h" }
+ module integral_constant { private header "__type_traits/integral_constant.h" }
+ module is_abstract { private header "__type_traits/is_abstract.h" }
+ module is_aggregate { private header "__type_traits/is_aggregate.h" }
+ module is_arithmetic { private header "__type_traits/is_arithmetic.h" }
+ module is_array { private header "__type_traits/is_array.h" }
+ module is_assignable { private header "__type_traits/is_assignable.h" }
+ module is_base_of { private header "__type_traits/is_base_of.h" }
+ module is_bounded_array { private header "__type_traits/is_bounded_array.h" }
+ module is_callable { private header "__type_traits/is_callable.h" }
+ module is_class { private header "__type_traits/is_class.h" }
+ module is_compound { private header "__type_traits/is_compound.h" }
+ module is_const { private header "__type_traits/is_const.h" }
+ module is_constant_evaluated { private header "__type_traits/is_constant_evaluated.h" }
+ module is_convertible { private header "__type_traits/is_convertible.h" }
+ module is_copy_assignable { private header "__type_traits/is_copy_assignable.h" }
+ module is_core_convertible { private header "__type_traits/is_core_convertible.h" }
+ module is_empty { private header "__type_traits/is_empty.h" }
+ module is_enum { private header "__type_traits/is_enum.h" }
+ module is_final { private header "__type_traits/is_final.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_fundamental { private header "__type_traits/is_fundamental.h" }
+ module is_integral { private header "__type_traits/is_integral.h" }
+ module is_literal_type { private header "__type_traits/is_literal_type.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_member_pointer { private header "__type_traits/is_member_pointer.h" }
+ module is_move_assignable { private header "__type_traits/is_move_assignable.h" }
+ module is_null_pointer { private header "__type_traits/is_null_pointer.h" }
+ module is_object { private header "__type_traits/is_object.h" }
+ module is_pod { private header "__type_traits/is_pod.h" }
+ module is_pointer { private header "__type_traits/is_pointer.h" }
+ module is_polymorphic { private header "__type_traits/is_polymorphic.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_scalar { private header "__type_traits/is_scalar.h" }
+ module is_scoped_enum { private header "__type_traits/is_scoped_enum.h" }
+ module is_signed { private header "__type_traits/is_signed.h" }
+ module is_standard_layout { private header "__type_traits/is_standard_layout.h" }
+ module is_trivial { private header "__type_traits/is_trivial.h" }
+ module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" }
+ module is_unbounded_array { private header "__type_traits/is_unbounded_array.h" }
+ module is_union { private header "__type_traits/is_union.h" }
+ module is_unsigned { private header "__type_traits/is_unsigned.h" }
+ module is_void { private header "__type_traits/is_void.h" }
+ module is_volatile { private header "__type_traits/is_volatile.h" }
+ module rank { private header "__type_traits/rank.h" }
+ module remove_all_extents { private header "__type_traits/remove_all_extents.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_pointer { private header "__type_traits/remove_pointer.h" }
+ module remove_reference { private header "__type_traits/remove_reference.h" }
+ module remove_volatile { private header "__type_traits/remove_volatile.h" }
+ module type_identity { private header "__type_traits/type_identity.h" }
+ module underlying_type { private header "__type_traits/underlying_type.h" }
}
module typeindex {
header "typeindex"
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 9e16987f6f07d..8e8d2d47b0f87 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -418,30 +418,38 @@ namespace std
*/
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__functional/invoke.h>
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_lvalue_reference.h>
#include <__type_traits/add_pointer.h>
#include <__type_traits/add_rvalue_reference.h>
#include <__type_traits/add_volatile.h>
+#include <__type_traits/alignment_of.h>
+#include <__type_traits/apply_cv.h>
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/decay.h>
#include <__type_traits/disjunction.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/extent.h>
+#include <__type_traits/has_unique_object_representation.h>
+#include <__type_traits/has_virtual_destructor.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_abstract.h>
#include <__type_traits/is_aggregate.h>
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_array.h>
+#include <__type_traits/is_assignable.h>
#include <__type_traits/is_base_of.h>
#include <__type_traits/is_bounded_array.h>
#include <__type_traits/is_callable.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_compound.h>
#include <__type_traits/is_const.h>
+#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_copy_assignable.h>
#include <__type_traits/is_empty.h>
#include <__type_traits/is_enum.h>
#include <__type_traits/is_final.h>
@@ -449,18 +457,26 @@ namespace std
#include <__type_traits/is_function.h>
#include <__type_traits/is_fundamental.h>
#include <__type_traits/is_integral.h>
+#include <__type_traits/is_literal_type.h>
#include <__type_traits/is_member_function_pointer.h>
#include <__type_traits/is_member_object_pointer.h>
#include <__type_traits/is_member_pointer.h>
+#include <__type_traits/is_move_assignable.h>
#include <__type_traits/is_null_pointer.h>
#include <__type_traits/is_object.h>
+#include <__type_traits/is_pod.h>
#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_polymorphic.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_scalar.h>
+#include <__type_traits/is_scoped_enum.h>
#include <__type_traits/is_signed.h>
+#include <__type_traits/is_standard_layout.h>
+#include <__type_traits/is_trivial.h>
+#include <__type_traits/is_trivially_copyable.h>
#include <__type_traits/is_unbounded_array.h>
#include <__type_traits/is_union.h>
#include <__type_traits/is_unsigned.h>
@@ -475,6 +491,7 @@ namespace std
#include <__type_traits/remove_reference.h>
#include <__type_traits/remove_volatile.h>
#include <__type_traits/type_identity.h>
+#include <__type_traits/underlying_type.h>
#include <__utility/declval.h>
#include <cstddef>
#include <version>
@@ -611,27 +628,6 @@ struct remove_cvref {
template <class _Tp> using remove_cvref_t = typename remove_cvref<_Tp>::type;
#endif
-
-struct __any
-{
- __any(...);
-};
-
-// __is_core_convertible
-
-// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed.
-// We can't test for that, but we can test implicit convertibility by passing it
-// to a function. Notice that __is_core_convertible<void,void> is false,
-// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later.
-
-template <class _Tp, class _Up, class = void>
-struct __is_core_convertible : public false_type {};
-
-template <class _Tp, class _Up>
-struct __is_core_convertible<_Tp, _Up, decltype(
- static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() )
-)> : public true_type {};
-
// is_nothrow_convertible
#if _LIBCPP_STD_VER > 17
@@ -658,73 +654,6 @@ inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To
#endif // _LIBCPP_STD_VER > 17
-// is_polymorphic
-
-#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_polymorphic
- : public integral_constant<bool, __is_polymorphic(_Tp)> {};
-
-#else
-
-template<typename _Tp> char &__is_polymorphic_impl(
- typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0,
- int>::type);
-template<typename _Tp> __two &__is_polymorphic_impl(...);
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_polymorphic
- : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {};
-
-#endif // __has_feature(is_polymorphic)
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
-#endif
-
-// has_virtual_destructor
-
-#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC)
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
- : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
- : public false_type {};
-
-#endif
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value;
-#endif
-
-// has_unique_object_representations
-
-#if _LIBCPP_STD_VER > 14
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
- : public integral_constant<bool,
- __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {};
-
-template <class _Tp>
-inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value;
-
-#endif
-
-// alignment_of
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of
- : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
-#endif
-
// aligned_storage
template <class _Hp, class _Tp>
@@ -734,16 +663,6 @@ struct __type_list
typedef _Tp _Tail;
};
-struct __nat
-{
-#ifndef _LIBCPP_CXX03_LANG
- __nat() = delete;
- __nat(const __nat&) = delete;
- __nat& operator=(const __nat&) = delete;
- ~__nat() = delete;
-#endif
-};
-
template <class _Tp>
struct __align_type
{
@@ -1009,55 +928,6 @@ struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
typedef _LIBCPP_NODEBUG typename __find_first<_Tp, _Size>::type type;
};
-template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
- bool = is_volatile<typename remove_reference<_Tp>::type>::value>
-struct __apply_cv
-{
- typedef _LIBCPP_NODEBUG _Up type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp, _Up, true, false>
-{
- typedef _LIBCPP_NODEBUG const _Up type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp, _Up, false, true>
-{
- typedef volatile _Up type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp, _Up, true, true>
-{
- typedef const volatile _Up type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp&, _Up, false, false>
-{
- typedef _Up& type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp&, _Up, true, false>
-{
- typedef const _Up& type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp&, _Up, false, true>
-{
- typedef volatile _Up& type;
-};
-
-template <class _Tp, class _Up>
-struct __apply_cv<_Tp&, _Up, true, true>
-{
- typedef const volatile _Up& type;
-};
-
template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_signed {};
@@ -1456,73 +1326,6 @@ template <class...> struct common_reference {};
#endif // _LIBCPP_STD_VER > 17
-// is_assignable
-
-template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; };
-
-#if __has_keyword(__is_assignable)
-
-template<class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { };
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp, class _Arg>
-inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg);
-#endif
-
-#else // __has_keyword(__is_assignable)
-
-template <class _Tp, class _Arg>
-typename __select_2nd<decltype((declval<_Tp>() = declval<_Arg>())), true_type>::type
-__is_assignable_test(int);
-
-template <class, class>
-false_type __is_assignable_test(...);
-
-
-template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value>
-struct __is_assignable_imp
- : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {};
-
-template <class _Tp, class _Arg>
-struct __is_assignable_imp<_Tp, _Arg, true>
- : public false_type
-{
-};
-
-template <class _Tp, class _Arg>
-struct is_assignable
- : public __is_assignable_imp<_Tp, _Arg> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp, class _Arg>
-inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value;
-#endif
-
-#endif // __has_keyword(__is_assignable)
-
-// is_copy_assignable
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable
- : public is_assignable<typename add_lvalue_reference<_Tp>::type,
- typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
-#endif
-
-// is_move_assignable
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable
- : public is_assignable<typename add_lvalue_reference<_Tp>::type,
- typename add_rvalue_reference<_Tp>::type> {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
-#endif
-
// is_destructible
#if __has_keyword(__is_destructible)
@@ -1600,235 +1403,6 @@ inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
#endif // __has_keyword(__is_destructible)
-template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
-struct __member_pointer_traits_imp
-{
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
-{
- typedef _Class const _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
-{
- typedef _Class const _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
-{
- typedef _Class volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
-{
- typedef _Class volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
-{
- typedef _Class const volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
-{
- typedef _Class const volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
-{
- typedef _Class& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
-{
- typedef _Class& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
-{
- typedef _Class const& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
-{
- typedef _Class const& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
-{
- typedef _Class volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
-{
- typedef _Class volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
-{
- typedef _Class const volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
-{
- typedef _Class const volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
-{
- typedef _Class&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
-{
- typedef _Class&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
-{
- typedef _Class const&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
-{
- typedef _Class const&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
-{
- typedef _Class volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
-{
- typedef _Class volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
-{
- typedef _Class const volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
-};
-
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
-{
- typedef _Class const volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
-};
-
-#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC)
-
-
-template <class _Rp, class _Class>
-struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
-};
-
-template <class _MP>
-struct __member_pointer_traits
- : public __member_pointer_traits_imp<typename remove_cv<_MP>::type,
- is_member_function_pointer<_MP>::value,
- is_member_object_pointer<_MP>::value>
-{
-// typedef ... _ClassType;
-// typedef ... _ReturnType;
-// typedef ... _FnType;
-};
-
-
-template <class _DecayedFp>
-struct __member_pointer_class_type {};
-
-template <class _Ret, class _ClassType>
-struct __member_pointer_class_type<_Ret _ClassType::*> {
- typedef _ClassType type;
-};
-
// template <class T, class... Args> struct is_constructible;
template <class _Tp, class ..._Args>
@@ -2221,302 +1795,6 @@ template <class _Tp>
inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value;
#endif
-// is_pod
-
-#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC)
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
- : public integral_constant<bool, __is_pod(_Tp)> {};
-
-#else
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
- : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value &&
- is_trivially_copy_constructible<_Tp>::value &&
- is_trivially_copy_assignable<_Tp>::value &&
- is_trivially_destructible<_Tp>::value> {};
-
-#endif
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_pod_v = is_pod<_Tp>::value;
-#endif
-
-// is_literal_type;
-
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type
- : public integral_constant<bool, __is_literal_type(_Tp)>
- {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
-#endif // _LIBCPP_STD_VER > 14
-#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-
-// is_standard_layout;
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
-#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC)
- : public integral_constant<bool, __is_standard_layout(_Tp)>
-#else
- : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
-#endif
- {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
-#endif
-
-// is_trivially_copyable;
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable
- : public integral_constant<bool, __is_trivially_copyable(_Tp)>
- {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
-#endif
-
-// is_trivial;
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
-#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC)
- : public integral_constant<bool, __is_trivial(_Tp)>
-#else
- : integral_constant<bool, is_trivially_copyable<_Tp>::value &&
- is_trivially_default_constructible<_Tp>::value>
-#endif
- {};
-
-#if _LIBCPP_STD_VER > 14
-template <class _Tp>
-inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
-#endif
-
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet1 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && is_base_of<_ClassT, _DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type>
-using __enable_if_bullet2 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && __is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet3 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && !is_base_of<_ClassT, _DecayA0>::value
- && !__is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet4 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && is_base_of<_ClassT, _DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type>
-using __enable_if_bullet5 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && __is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = typename decay<_Fp>::type,
- class _DecayA0 = typename decay<_A0>::type,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet6 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && !is_base_of<_ClassT, _DecayA0>::value
- && !__is_reference_wrapper<_DecayA0>::value
- >::type;
-
-// __invoke forward declarations
-
-// fall back - none of the bullets
-
-template <class ..._Args>
-auto __invoke(__any, _Args&& ...__args) -> __nat;
-
-// bullets 1, 2 and 3
-
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet1<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
- noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
- -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))
- { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }
-
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet2<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
- noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
- -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...))
- { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }
-
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet3<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
- noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
- -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))
- { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); }
-
-// bullets 4, 5 and 6
-
-template <class _Fp, class _A0,
- class = __enable_if_bullet4<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0)
- noexcept(noexcept(static_cast<_A0&&>(__a0).*__f))
- -> decltype( static_cast<_A0&&>(__a0).*__f)
- { return static_cast<_A0&&>(__a0).*__f; }
-
-template <class _Fp, class _A0,
- class = __enable_if_bullet5<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0)
- noexcept(noexcept(__a0.get().*__f))
- -> decltype( __a0.get().*__f)
- { return __a0.get().*__f; }
-
-template <class _Fp, class _A0,
- class = __enable_if_bullet6<_Fp, _A0>>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _A0&& __a0)
- noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f))
- -> decltype( (*static_cast<_A0&&>(__a0)).*__f)
- { return (*static_cast<_A0&&>(__a0)).*__f; }
-
-// bullet 7
-
-template <class _Fp, class ..._Args>
-inline _LIBCPP_INLINE_VISIBILITY
-constexpr auto
-__invoke(_Fp&& __f, _Args&& ...__args)
- noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
- -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))
- { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
-
-// __invokable
-template <class _Ret, class _Fp, class ..._Args>
-struct __invokable_r
-{
- template <class _XFp, class ..._XArgs>
- static auto __try_call(int) -> decltype(
- _VSTD::__invoke(declval<_XFp>(), declval<_XArgs>()...));
- template <class _XFp, class ..._XArgs>
- static __nat __try_call(...);
-
- // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
- // or incomplete array types as required by the standard.
- using _Result = decltype(__try_call<_Fp, _Args...>(0));
-
- using type = typename conditional<
- _IsNotSame<_Result, __nat>::value,
- typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type,
- false_type >::type;
- static const bool value = type::value;
-};
-template <class _Fp, class ..._Args>
-using __invokable = __invokable_r<void, _Fp, _Args...>;
-
-template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args>
-struct __nothrow_invokable_r_imp {
- static const bool value = false;
-};
-
-template <class _Ret, class _Fp, class ..._Args>
-struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
-{
- typedef __nothrow_invokable_r_imp _ThisT;
-
- template <class _Tp>
- static void __test_noexcept(_Tp) noexcept;
-
- static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(
- _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)));
-};
-
-template <class _Ret, class _Fp, class ..._Args>
-struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
-{
- static const bool value = noexcept(
- _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...));
-};
-
-template <class _Ret, class _Fp, class ..._Args>
-using __nothrow_invokable_r =
- __nothrow_invokable_r_imp<
- __invokable_r<_Ret, _Fp, _Args...>::value,
- is_void<_Ret>::value,
- _Ret, _Fp, _Args...
- >;
-
-template <class _Fp, class ..._Args>
-using __nothrow_invokable =
- __nothrow_invokable_r_imp<
- __invokable<_Fp, _Args...>::value,
- true, void, _Fp, _Args...
- >;
-
-template <class _Fp, class ..._Args>
-struct __invoke_of
- : public enable_if<
- __invokable<_Fp, _Args...>::value,
- typename __invokable_r<void, _Fp, _Args...>::_Result>
-{
-};
-
-#else
-
-// Assume that it's a functor in C++03
-template <class _Func, class... _Args>
-_LIBCPP_HIDE_FROM_ABI
-decltype(std::declval<_Func>()(std::declval<_Args>()...)) __invoke(_Func&& __func, _Args&&... __args) {
- return static_cast<_Func&&>(__func)(static_cast<_Args&&>(__args)...);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
// result_of
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
@@ -2612,53 +1890,6 @@ template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename re
#endif // _LIBCPP_STD_VER > 11
#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-#if _LIBCPP_STD_VER > 14
-
-// invoke_result
-
-template <class _Fn, class... _Args>
-struct _LIBCPP_TEMPLATE_VIS invoke_result
- : __invoke_of<_Fn, _Args...>
-{
-};
-
-template <class _Fn, class... _Args>
-using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
-
-// is_invocable
-
-template <class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_invocable
- : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};
-
-template <class _Ret, class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_invocable_r
- : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {};
-
-template <class _Fn, class ..._Args>
-inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
-
-template <class _Ret, class _Fn, class ..._Args>
-inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value;
-
-// is_nothrow_invocable
-
-template <class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable
- : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {};
-
-template <class _Ret, class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r
- : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {};
-
-template <class _Fn, class ..._Args>
-inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value;
-
-template <class _Ret, class _Fn, class ..._Args>
-inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
-
-#endif // _LIBCPP_STD_VER > 14
-
// __swappable
template <class _Tp> struct __is_swappable;
@@ -2791,24 +2022,6 @@ inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value;
#endif // _LIBCPP_STD_VER > 14
-template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl;
-
-template <class _Tp>
-struct __underlying_type_impl<_Tp, false> {};
-
-template <class _Tp>
-struct __underlying_type_impl<_Tp, true>
-{
- typedef __underlying_type(_Tp) type;
-};
-
-template <class _Tp>
-struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
-#endif
-
template <class _Tp, bool = is_enum<_Tp>::value>
struct __sfinae_underlying_type
{
@@ -2855,24 +2068,6 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename __sfinae_underlying_type<_Tp>::__promoted_type
__convert_to_integral(_Tp __val) { return __val; }
-// is_scoped_enum [meta.unary.prop]
-
-#if _LIBCPP_STD_VER > 20
-template <class _Tp, bool = is_enum_v<_Tp> >
-struct __is_scoped_enum_helper : false_type {};
-
-template <class _Tp>
-struct __is_scoped_enum_helper<_Tp, true>
- : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_scoped_enum
- : public __is_scoped_enum_helper<_Tp> {};
-
-template <class _Tp>
-inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
-#endif
-
#if _LIBCPP_STD_VER > 14
template <class _Tp>
struct negation : _Not<_Tp> {};
@@ -2910,16 +2105,6 @@ template <class _ValTy, class _Key, class _RawValTy>
struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
: false_type {};
-#if _LIBCPP_STD_VER > 17
-_LIBCPP_INLINE_VISIBILITY
-inline constexpr bool is_constant_evaluated() noexcept {
- return __builtin_is_constant_evaluated();
-}
-#endif
-
-inline _LIBCPP_CONSTEXPR
-bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
-
template <class _CharT>
using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
diff --git a/libcxx/include/utility b/libcxx/include/utility
index bcd4abfcd1114..9fa867f96cac6 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -242,6 +242,7 @@ template <class T>
#include <__utility/unreachable.h>
#include <compare>
#include <initializer_list>
+#include <type_traits>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp
index fcc60e15e7287..b210d5c8ad173 100644
--- a/libcxx/test/libcxx/private_headers.verify.cpp
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -466,24 +466,32 @@ END-SCRIPT
#include <__type_traits/add_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_pointer.h'}}
#include <__type_traits/add_rvalue_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_rvalue_reference.h'}}
#include <__type_traits/add_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_volatile.h'}}
+#include <__type_traits/alignment_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/alignment_of.h'}}
+#include <__type_traits/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/apply_cv.h'}}
#include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}}
#include <__type_traits/conjunction.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conjunction.h'}}
#include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}}
#include <__type_traits/disjunction.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/disjunction.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/extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/extent.h'}}
+#include <__type_traits/has_unique_object_representation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_unique_object_representation.h'}}
+#include <__type_traits/has_virtual_destructor.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_virtual_destructor.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_abstract.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_abstract.h'}}
#include <__type_traits/is_aggregate.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_aggregate.h'}}
#include <__type_traits/is_arithmetic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_arithmetic.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_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_assignable.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_bounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_bounded_array.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_class.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_class.h'}}
#include <__type_traits/is_compound.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_compound.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_constant_evaluated.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_constant_evaluated.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_copy_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_copy_assignable.h'}}
+#include <__type_traits/is_core_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_core_convertible.h'}}
#include <__type_traits/is_empty.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_empty.h'}}
#include <__type_traits/is_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_enum.h'}}
#include <__type_traits/is_final.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_final.h'}}
@@ -491,18 +499,26 @@ END-SCRIPT
#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_fundamental.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_fundamental.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_literal_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_literal_type.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_member_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_pointer.h'}}
+#include <__type_traits/is_move_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_move_assignable.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_object.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_object.h'}}
+#include <__type_traits/is_pod.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pod.h'}}
#include <__type_traits/is_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pointer.h'}}
+#include <__type_traits/is_polymorphic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_polymorphic.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_scalar.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scalar.h'}}
+#include <__type_traits/is_scoped_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scoped_enum.h'}}
#include <__type_traits/is_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed.h'}}
+#include <__type_traits/is_standard_layout.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_standard_layout.h'}}
+#include <__type_traits/is_trivial.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivial.h'}}
+#include <__type_traits/is_trivially_copyable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_copyable.h'}}
#include <__type_traits/is_unbounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unbounded_array.h'}}
#include <__type_traits/is_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_union.h'}}
#include <__type_traits/is_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unsigned.h'}}
@@ -517,6 +533,7 @@ END-SCRIPT
#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 <__type_traits/type_identity.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_identity.h'}}
+#include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.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'}}
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp
index 86954017c0839..7624dfd54279b 100644
--- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp
@@ -20,7 +20,7 @@
#include "test_macros.h"
-enum E1 { E1Zero, E1One, E1Two = sizeof(std::underlying_type<E1>::type) }; // expected-error at type_traits:* {{cannot determine underlying type of incomplete enumeration type 'E1'}}
+enum E1 { E1Zero, E1One, E1Two = sizeof(std::underlying_type<E1>::type) }; // expected-error@*:* {{cannot determine underlying type of incomplete enumeration type 'E1'}}
// None of these are incomplete.
// Scoped enums have an underlying type of 'int' unless otherwise specified
More information about the libcxx-commits
mailing list