[libcxx-commits] [libcxx] 7ae66e5 - [libc++] Granularize the rest of type_traits
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Aug 14 01:30:53 PDT 2022
Author: Nikolas Klauser
Date: 2022-08-14T10:30:48+02:00
New Revision: 7ae66e5e9593f0bc470b5796d50c5b8979f62665
URL: https://github.com/llvm/llvm-project/commit/7ae66e5e9593f0bc470b5796d50c5b8979f62665
DIFF: https://github.com/llvm/llvm-project/commit/7ae66e5e9593f0bc470b5796d50c5b8979f62665.diff
LOG: [libc++] Granularize the rest of type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D130471
Added:
libcxx/include/__fwd/hash.h
libcxx/include/__fwd/pair.h
libcxx/include/__type_traits/can_extract_key.h
libcxx/include/__type_traits/dependent_type.h
libcxx/include/__type_traits/is_char_like_type.h
libcxx/include/__type_traits/is_implicitly_default_constructible.h
libcxx/include/__type_traits/is_swappable.h
libcxx/include/__type_traits/make_const_lvalue_ref.h
libcxx/include/__type_traits/maybe_const.h
libcxx/include/__type_traits/remove_const_ref.h
libcxx/include/__type_traits/result_of.h
libcxx/include/__utility/convert_to_integral.h
Modified:
libcxx/include/CMakeLists.txt
libcxx/include/__algorithm/copy_backward.h
libcxx/include/__algorithm/copy_n.h
libcxx/include/__algorithm/fill_n.h
libcxx/include/__algorithm/for_each_n.h
libcxx/include/__algorithm/generate_n.h
libcxx/include/__algorithm/search_n.h
libcxx/include/__compare/compare_three_way_result.h
libcxx/include/__compare/three_way_comparable.h
libcxx/include/__concepts/assignable.h
libcxx/include/__concepts/equality_comparable.h
libcxx/include/__concepts/swappable.h
libcxx/include/__functional/hash.h
libcxx/include/__fwd/span.h
libcxx/include/__fwd/string_view.h
libcxx/include/__hash_table
libcxx/include/__iterator/advance.h
libcxx/include/__iterator/iterator_traits.h
libcxx/include/__memory/compressed_pair.h
libcxx/include/__ranges/join_view.h
libcxx/include/__ranges/lazy_split_view.h
libcxx/include/__ranges/take_view.h
libcxx/include/__ranges/transform_view.h
libcxx/include/__threading_support
libcxx/include/__tree
libcxx/include/__tuple
libcxx/include/__utility/pair.h
libcxx/include/bitset
libcxx/include/experimental/propagate_const
libcxx/include/module.modulemap.in
libcxx/include/tuple
libcxx/include/type_traits
libcxx/include/variant
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index f7c2d99e78b08..78f86e77079af 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -332,6 +332,8 @@ set(files
__functional/unary_negate.h
__functional/unwrap_ref.h
__functional/weak_result_type.h
+ __fwd/hash.h
+ __fwd/pair.h
__fwd/span.h
__fwd/string_view.h
__hash_table
@@ -518,6 +520,7 @@ set(files
__type_traits/aligned_union.h
__type_traits/alignment_of.h
__type_traits/apply_cv.h
+ __type_traits/can_extract_key.h
__type_traits/common_reference.h
__type_traits/common_type.h
__type_traits/conditional.h
@@ -525,6 +528,7 @@ set(files
__type_traits/copy_cv.h
__type_traits/copy_cvref.h
__type_traits/decay.h
+ __type_traits/dependent_type.h
__type_traits/disjunction.h
__type_traits/enable_if.h
__type_traits/extent.h
@@ -539,6 +543,7 @@ set(files
__type_traits/is_base_of.h
__type_traits/is_bounded_array.h
__type_traits/is_callable.h
+ __type_traits/is_char_like_type.h
__type_traits/is_class.h
__type_traits/is_compound.h
__type_traits/is_const.h
@@ -556,6 +561,7 @@ set(files
__type_traits/is_floating_point.h
__type_traits/is_function.h
__type_traits/is_fundamental.h
+ __type_traits/is_implicitly_default_constructible.h
__type_traits/is_integral.h
__type_traits/is_literal_type.h
__type_traits/is_member_function_pointer.h
@@ -587,6 +593,7 @@ set(files
__type_traits/is_signed.h
__type_traits/is_signed_integer.h
__type_traits/is_standard_layout.h
+ __type_traits/is_swappable.h
__type_traits/is_trivial.h
__type_traits/is_trivially_assignable.h
__type_traits/is_trivially_constructible.h
@@ -606,20 +613,24 @@ set(files
__type_traits/is_volatile.h
__type_traits/lazy.h
__type_traits/make_32_64_or_128_bit.h
+ __type_traits/make_const_lvalue_ref.h
__type_traits/make_signed.h
__type_traits/make_unsigned.h
+ __type_traits/maybe_const.h
__type_traits/nat.h
__type_traits/negation.h
__type_traits/promote.h
__type_traits/rank.h
__type_traits/remove_all_extents.h
__type_traits/remove_const.h
+ __type_traits/remove_const_ref.h
__type_traits/remove_cv.h
__type_traits/remove_cvref.h
__type_traits/remove_extent.h
__type_traits/remove_pointer.h
__type_traits/remove_reference.h
__type_traits/remove_volatile.h
+ __type_traits/result_of.h
__type_traits/type_identity.h
__type_traits/type_list.h
__type_traits/underlying_type.h
@@ -628,6 +639,7 @@ set(files
__utility/as_const.h
__utility/auto_cast.h
__utility/cmp.h
+ __utility/convert_to_integral.h
__utility/declval.h
__utility/exchange.h
__utility/forward.h
diff --git a/libcxx/include/__algorithm/copy_backward.h b/libcxx/include/__algorithm/copy_backward.h
index c5fa64bc8d751..93806013a67ef 100644
--- a/libcxx/include/__algorithm/copy_backward.h
+++ b/libcxx/include/__algorithm/copy_backward.h
@@ -20,6 +20,7 @@
#include <__ranges/subrange.h>
#include <__utility/move.h>
#include <__utility/pair.h>
+#include <cstring>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/copy_n.h b/libcxx/include/__algorithm/copy_n.h
index 8b915af63c0db..f7e58d374b6c3 100644
--- a/libcxx/include/__algorithm/copy_n.h
+++ b/libcxx/include/__algorithm/copy_n.h
@@ -12,6 +12,7 @@
#include <__algorithm/copy.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/convert_to_integral.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index 6c5e44efde9b0..5433a2494ff65 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__utility/convert_to_integral.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/for_each_n.h b/libcxx/include/__algorithm/for_each_n.h
index 2552b40c2781c..17bf5b349f859 100644
--- a/libcxx/include/__algorithm/for_each_n.h
+++ b/libcxx/include/__algorithm/for_each_n.h
@@ -11,6 +11,7 @@
#define _LIBCPP___ALGORITHM_FOR_EACH_N_H
#include <__config>
+#include <__utility/convert_to_integral.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/generate_n.h b/libcxx/include/__algorithm/generate_n.h
index 2650e9e5d8b70..cb4080476eab6 100644
--- a/libcxx/include/__algorithm/generate_n.h
+++ b/libcxx/include/__algorithm/generate_n.h
@@ -10,6 +10,7 @@
#define _LIBCPP___ALGORITHM_GENERATE_N_H
#include <__config>
+#include <__utility/convert_to_integral.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/search_n.h b/libcxx/include/__algorithm/search_n.h
index ccb8e845f5b1f..707c8a9bb2359 100644
--- a/libcxx/include/__algorithm/search_n.h
+++ b/libcxx/include/__algorithm/search_n.h
@@ -19,6 +19,7 @@
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/concepts.h>
+#include <__utility/convert_to_integral.h>
#include <__utility/pair.h>
#include <type_traits> // __convert_to_integral
diff --git a/libcxx/include/__compare/compare_three_way_result.h b/libcxx/include/__compare/compare_three_way_result.h
index 7b03597ab1c12..3047f5bd2a3c1 100644
--- a/libcxx/include/__compare/compare_three_way_result.h
+++ b/libcxx/include/__compare/compare_three_way_result.h
@@ -10,6 +10,7 @@
#define _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H
#include <__config>
+#include <__type_traits/make_const_lvalue_ref.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__compare/three_way_comparable.h b/libcxx/include/__compare/three_way_comparable.h
index b317d750590e8..cab2cb289677f 100644
--- a/libcxx/include/__compare/three_way_comparable.h
+++ b/libcxx/include/__compare/three_way_comparable.h
@@ -16,6 +16,7 @@
#include <__concepts/same_as.h>
#include <__concepts/totally_ordered.h>
#include <__config>
+#include <__type_traits/make_const_lvalue_ref.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__concepts/assignable.h b/libcxx/include/__concepts/assignable.h
index 7f187a39f8f8c..db09e5a0a5d11 100644
--- a/libcxx/include/__concepts/assignable.h
+++ b/libcxx/include/__concepts/assignable.h
@@ -12,6 +12,7 @@
#include <__concepts/common_reference_with.h>
#include <__concepts/same_as.h>
#include <__config>
+#include <__type_traits/make_const_lvalue_ref.h>
#include <__utility/forward.h>
#include <type_traits>
diff --git a/libcxx/include/__concepts/equality_comparable.h b/libcxx/include/__concepts/equality_comparable.h
index 7c750c5937b52..c2293d5cd014b 100644
--- a/libcxx/include/__concepts/equality_comparable.h
+++ b/libcxx/include/__concepts/equality_comparable.h
@@ -12,6 +12,7 @@
#include <__concepts/boolean_testable.h>
#include <__concepts/common_reference_with.h>
#include <__config>
+#include <__type_traits/make_const_lvalue_ref.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h
index fef940f21fed7..dbb428364550b 100644
--- a/libcxx/include/__concepts/swappable.h
+++ b/libcxx/include/__concepts/swappable.h
@@ -17,6 +17,7 @@
#include <__utility/exchange.h>
#include <__utility/forward.h>
#include <__utility/move.h>
+#include <__utility/swap.h>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 8a11931288cfa..138323f5713ca 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__functional/unary_function.h>
+#include <__fwd/hash.h>
#include <__tuple>
#include <__utility/forward.h>
#include <__utility/move.h>
diff --git a/libcxx/include/__fwd/hash.h b/libcxx/include/__fwd/hash.h
new file mode 100644
index 0000000000000..af9eca876a104
--- /dev/null
+++ b/libcxx/include/__fwd/hash.h
@@ -0,0 +1,25 @@
+//===---------------------------------------------------------------------===//
+//
+// 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___FWD_HASH_H
+#define _LIBCPP___FWD_HASH_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class>
+struct _LIBCPP_TEMPLATE_VIS hash;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_HASH_H
diff --git a/libcxx/include/__fwd/pair.h b/libcxx/include/__fwd/pair.h
new file mode 100644
index 0000000000000..3844014de3adb
--- /dev/null
+++ b/libcxx/include/__fwd/pair.h
@@ -0,0 +1,25 @@
+//===---------------------------------------------------------------------===//
+//
+// 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___FWD_PAIR_H
+#define _LIBCPP___FWD_PAIR_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class, class>
+struct _LIBCPP_TEMPLATE_VIS pair;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FWD_PAIR_H
diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__fwd/span.h
index f38b8cfa05260..943cb13fa1bbc 100644
--- a/libcxx/include/__fwd/span.h
+++ b/libcxx/include/__fwd/span.h
@@ -7,8 +7,8 @@
//
//===---------------------------------------------------------------------===//
-#ifndef _LIBCPP_FWD_SPAN_H
-#define _LIBCPP_FWD_SPAN_H
+#ifndef _LIBCPP___FWD_SPAN_H
+#define _LIBCPP___FWD_SPAN_H
#include <__config>
#include <cstddef>
@@ -34,4 +34,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // _LIBCPP_FWD_SPAN_H
+#endif // _LIBCPP___FWD_SPAN_H
diff --git a/libcxx/include/__fwd/string_view.h b/libcxx/include/__fwd/string_view.h
index e5e77b292a6ef..4324c9f179417 100644
--- a/libcxx/include/__fwd/string_view.h
+++ b/libcxx/include/__fwd/string_view.h
@@ -7,8 +7,8 @@
//
//===---------------------------------------------------------------------===//
-#ifndef _LIBCPP_FWD_STRING_VIEW_H
-#define _LIBCPP_FWD_STRING_VIEW_H
+#ifndef _LIBCPP___FWD_STRING_VIEW_H
+#define _LIBCPP___FWD_STRING_VIEW_H
#include <__config>
#include <iosfwd> // char_traits
@@ -34,4 +34,4 @@ typedef basic_string_view<wchar_t> wstring_view;
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_FWD_STRING_VIEW_H
+#endif // _LIBCPP___FWD_STRING_VIEW_H
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 959ef7fe7d83c..18d4d350eb36a 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -19,6 +19,7 @@
#include <__functional/hash.h>
#include <__iterator/iterator_traits.h>
#include <__memory/swap_allocator.h>
+#include <__type_traits/can_extract_key.h>
#include <__utility/swap.h>
#include <cmath>
#include <initializer_list>
diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h
index 4b8b0dc970a17..13b18defb456b 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -15,6 +15,7 @@
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
+#include <__utility/convert_to_integral.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <concepts>
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h
index 0cc64adc0de96..35d68de2d49c0 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -11,6 +11,7 @@
#define _LIBCPP___ITERATOR_ITERATOR_TRAITS_H
#include <__config>
+#include <__fwd/pair.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/readable_traits.h>
#include <concepts>
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 89e5820e992a0..88c3a1bb54b98 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -11,6 +11,7 @@
#define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
#include <__config>
+#include <__type_traits/dependent_type.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <tuple> // needed in c++03 for some constructors
diff --git a/libcxx/include/__ranges/join_view.h b/libcxx/include/__ranges/join_view.h
index b6fcce95aeda9..8443d32a37131 100644
--- a/libcxx/include/__ranges/join_view.h
+++ b/libcxx/include/__ranges/join_view.h
@@ -25,6 +25,7 @@
#include <__ranges/non_propagating_cache.h>
#include <__ranges/range_adaptor.h>
#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
#include <__utility/forward.h>
#include <optional>
#include <type_traits>
@@ -210,7 +211,7 @@ namespace ranges {
public:
using iterator_concept = _If<
- __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
+ __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
common_range<range_reference_t<_Base>>,
bidirectional_iterator_tag,
_If<
@@ -345,7 +346,7 @@ namespace ranges {
template<class _Range>
explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
-
+
namespace views {
namespace __join_view {
struct __fn : __range_adaptor_closure<__fn> {
diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h
index e559a76ef7b77..841aea79305a3 100644
--- a/libcxx/include/__ranges/lazy_split_view.h
+++ b/libcxx/include/__ranges/lazy_split_view.h
@@ -35,6 +35,7 @@
#include <__ranges/single_view.h>
#include <__ranges/subrange.h>
#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <type_traits>
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 11d5c9fc36bc4..948b21b7e155d 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -30,6 +30,7 @@
#include <__ranges/size.h>
#include <__ranges/subrange.h>
#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <__utility/move.h>
diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h
index c5a7128c366b5..11924bdbbf300 100644
--- a/libcxx/include/__ranges/transform_view.h
+++ b/libcxx/include/__ranges/transform_view.h
@@ -30,6 +30,7 @@
#include <__ranges/range_adaptor.h>
#include <__ranges/size.h>
#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index 55f5af2f3f584..dcf2763ad6464 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -15,6 +15,7 @@
#include <__chrono/duration.h>
#include <__compare/ordering.h>
#include <__config>
+#include <__fwd/hash.h>
#include <__thread/poll_with_backoff.h>
#include <errno.h>
#include <iosfwd>
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index dac1596de1baa..867a8561dcd99 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -18,6 +18,7 @@
#include <__iterator/iterator_traits.h>
#include <__iterator/next.h>
#include <__memory/swap_allocator.h>
+#include <__type_traits/can_extract_key.h>
#include <__utility/forward.h>
#include <__utility/swap.h>
#include <limits>
diff --git a/libcxx/include/__tuple b/libcxx/include/__tuple
index f85036e7af1db..408d029612f54 100644
--- a/libcxx/include/__tuple
+++ b/libcxx/include/__tuple
@@ -11,6 +11,7 @@
#define _LIBCPP___TUPLE
#include <__config>
+#include <__fwd/pair.h>
#include <cstddef>
#include <type_traits>
diff --git a/libcxx/include/__type_traits/can_extract_key.h b/libcxx/include/__type_traits/can_extract_key.h
new file mode 100644
index 0000000000000..ab9bcc54e06b2
--- /dev/null
+++ b/libcxx/include/__type_traits/can_extract_key.h
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CAN_EXTRACT_KEY_H
+#define _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H
+
+#include <__config>
+#include <__fwd/pair.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_const_ref.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// These traits are used in __tree and __hash_table
+struct __extract_key_fail_tag {};
+struct __extract_key_self_tag {};
+struct __extract_key_first_tag {};
+
+template <class _ValTy, class _Key,
+ class _RawValTy = typename __unconstref<_ValTy>::type>
+struct __can_extract_key
+ : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag,
+ __extract_key_fail_tag>::type {};
+
+template <class _Pair, class _Key, class _First, class _Second>
+struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
+ : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value,
+ __extract_key_first_tag, __extract_key_fail_tag>::type {};
+
+// __can_extract_map_key uses true_type/false_type instead of the tags.
+// It returns true if _Key != _ContainerValueTy (the container is a map not a set)
+// and _ValTy == _Key.
+template <class _ValTy, class _Key, class _ContainerValueTy,
+ class _RawValTy = typename __unconstref<_ValTy>::type>
+struct __can_extract_map_key
+ : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
+
+// This specialization returns __extract_key_fail_tag for non-map containers
+// because _Key == _ContainerValueTy
+template <class _ValTy, class _Key, class _RawValTy>
+struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
+ : false_type {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H
diff --git a/libcxx/include/__type_traits/dependent_type.h b/libcxx/include/__type_traits/dependent_type.h
new file mode 100644
index 0000000000000..db8a869820db3
--- /dev/null
+++ b/libcxx/include/__type_traits/dependent_type.h
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_DEPENDENT_TYPE_H
+#define _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp, bool>
+struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H
diff --git a/libcxx/include/__type_traits/is_char_like_type.h b/libcxx/include/__type_traits/is_char_like_type.h
new file mode 100644
index 0000000000000..26205843047ca
--- /dev/null
+++ b/libcxx/include/__type_traits/is_char_like_type.h
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H
+#define _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H
+
+#include <__config>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/is_standard_layout.h>
+#include <__type_traits/is_trivial.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT>
+using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H
diff --git a/libcxx/include/__type_traits/is_implicitly_default_constructible.h b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
new file mode 100644
index 0000000000000..3643897a2d6da
--- /dev/null
+++ b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_default_constructible.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_CXX03_LANG
+// First of all, we can't implement this check in C++03 mode because the {}
+// default initialization syntax isn't valid.
+// Second, we implement the trait in a funny manner with two defaulted template
+// arguments to workaround Clang's PR43454.
+template <class _Tp>
+void __test_implicit_default_constructible(_Tp);
+
+template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
+struct __is_implicitly_default_constructible
+ : false_type
+{ };
+
+template <class _Tp>
+struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type>
+ : true_type
+{ };
+
+template <class _Tp>
+struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type>
+ : false_type
+{ };
+#endif // !C++03
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
new file mode 100644
index 0000000000000..fdc9b1086b0ac
--- /dev/null
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -0,0 +1,165 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_SWAPPABLE_H
+#define _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H
+
+#include <__config>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_move_assignable.h>
+#include <__type_traits/is_move_constructible.h>
+#include <__type_traits/is_nothrow_move_assignable.h>
+#include <__type_traits/is_nothrow_move_constructible.h>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/nat.h>
+#include <__utility/declval.h>
+#include <cstddef>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp> struct __is_swappable;
+template <class _Tp> struct __is_nothrow_swappable;
+
+
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Tp>
+using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
+#else
+template <class>
+using __swap_result_t = void;
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp>
+swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
+ is_nothrow_move_assignable<_Tp>::value);
+
+template<class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
+typename enable_if<
+ __is_swappable<_Tp>::value
+>::type
+swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
+
+namespace __detail
+{
+// ALL generic swap overloads MUST already have a declaration available at this point.
+
+template <class _Tp, class _Up = _Tp,
+ bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
+struct __swappable_with
+{
+ template <class _LHS, class _RHS>
+ static decltype(swap(declval<_LHS>(), declval<_RHS>()))
+ __test_swap(int);
+ template <class, class>
+ static __nat __test_swap(long);
+
+ // Extra parens are needed for the C++03 definition of decltype.
+ typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
+ typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
+
+ static const bool value = _IsNotSame<__swap1, __nat>::value
+ && _IsNotSame<__swap2, __nat>::value;
+};
+
+template <class _Tp, class _Up>
+struct __swappable_with<_Tp, _Up, false> : false_type {};
+
+template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value>
+struct __nothrow_swappable_with {
+ static const bool value =
+#ifndef _LIBCPP_HAS_NO_NOEXCEPT
+ noexcept(swap(declval<_Tp>(), declval<_Up>()))
+ && noexcept(swap(declval<_Up>(), declval<_Tp>()));
+#else
+ false;
+#endif
+};
+
+template <class _Tp, class _Up>
+struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {};
+
+} // namespace __detail
+
+template <class _Tp>
+struct __is_swappable
+ : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value>
+{
+};
+
+template <class _Tp>
+struct __is_nothrow_swappable
+ : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value>
+{
+};
+
+#if _LIBCPP_STD_VER > 14
+
+template <class _Tp, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_swappable_with
+ : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_swappable
+ : public conditional<
+ __is_referenceable<_Tp>::value,
+ is_swappable_with<
+ typename add_lvalue_reference<_Tp>::type,
+ typename add_lvalue_reference<_Tp>::type>,
+ false_type
+ >::type
+{
+};
+
+template <class _Tp, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
+ : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
+ : public conditional<
+ __is_referenceable<_Tp>::value,
+ is_nothrow_swappable_with<
+ typename add_lvalue_reference<_Tp>::type,
+ typename add_lvalue_reference<_Tp>::type>,
+ false_type
+ >::type
+{
+};
+
+template <class _Tp, class _Up>
+inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value;
+
+template <class _Tp>
+inline constexpr bool is_swappable_v = is_swappable<_Tp>::value;
+
+template <class _Tp, class _Up>
+inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value;
+
+template <class _Tp>
+inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value;
+
+#endif // _LIBCPP_STD_VER > 14
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H
diff --git a/libcxx/include/__type_traits/make_const_lvalue_ref.h b/libcxx/include/__type_traits/make_const_lvalue_ref.h
new file mode 100644
index 0000000000000..831305f2d3aa1
--- /dev/null
+++ b/libcxx/include/__type_traits/make_const_lvalue_ref.h
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_MAKE_CONST_LVALUE_REF_H
+#define _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H
+
+#include <__config>
+#include <__type_traits/remove_reference.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template<class _Tp>
+using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H
diff --git a/libcxx/include/__type_traits/maybe_const.h b/libcxx/include/__type_traits/maybe_const.h
new file mode 100644
index 0000000000000..4f1908ae5dd81
--- /dev/null
+++ b/libcxx/include/__type_traits/maybe_const.h
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_MAYBE_CONST_H
+#define _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H
+
+#include <__config>
+#include <__type_traits/conditional.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template<bool _Const, class _Tp>
+using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type;
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H
diff --git a/libcxx/include/__type_traits/remove_const_ref.h b/libcxx/include/__type_traits/remove_const_ref.h
new file mode 100644
index 0000000000000..2e3f5e4d41d41
--- /dev/null
+++ b/libcxx/include/__type_traits/remove_const_ref.h
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H
+#define _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H
+
+#include <__config>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_reference.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp>
+struct __unconstref {
+ typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type;
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H
diff --git a/libcxx/include/__type_traits/result_of.h b/libcxx/include/__type_traits/result_of.h
new file mode 100644
index 0000000000000..804173e15e21e
--- /dev/null
+++ b/libcxx/include/__type_traits/result_of.h
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_RESULT_OF_H
+#define _LIBCPP___TYPE_TRAITS_RESULT_OF_H
+
+#include <__config>
+#include <__functional/invoke.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// result_of
+
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
+
+template <class _Fp, class ..._Args>
+class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
+ : public __invoke_of<_Fp, _Args...>
+{
+};
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
+#endif // _LIBCPP_STD_VER > 11
+#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H
diff --git a/libcxx/include/__utility/convert_to_integral.h b/libcxx/include/__utility/convert_to_integral.h
new file mode 100644
index 0000000000000..0cc858ad15907
--- /dev/null
+++ b/libcxx/include/__utility/convert_to_integral.h
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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___UTILITY_CONVERT_TO_INTEGRAL_H
+#define _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H
+
+#include <__config>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_enum.h>
+#include <__type_traits/is_floating_point.h>
+#include <__type_traits/underlying_type.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+int __convert_to_integral(int __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+unsigned __convert_to_integral(unsigned __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+long __convert_to_integral(long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+unsigned long __convert_to_integral(unsigned long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+long long __convert_to_integral(long long __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
+
+template<typename _Fp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if<is_floating_point<_Fp>::value, long long>::type
+ __convert_to_integral(_Fp __val) { return __val; }
+
+#ifndef _LIBCPP_HAS_NO_INT128
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+__int128_t __convert_to_integral(__int128_t __val) { return __val; }
+
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
+#endif
+
+template <class _Tp, bool = is_enum<_Tp>::value>
+struct __sfinae_underlying_type
+{
+ typedef typename underlying_type<_Tp>::type type;
+ typedef decltype(((type)1) + 0) __promoted_type;
+};
+
+template <class _Tp>
+struct __sfinae_underlying_type<_Tp, false> {};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename __sfinae_underlying_type<_Tp>::__promoted_type
+__convert_to_integral(_Tp __val) { return __val; }
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 97635c2e61b51..c2b8af66687bb 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -14,6 +14,7 @@
#include <__config>
#include <__functional/unwrap_ref.h>
#include <__tuple>
+#include <__type_traits/is_implicitly_default_constructible.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index 28aad5dc37272..67760a75662dd 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -118,6 +118,7 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <__config>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
+#include <__type_traits/is_char_like_type.h>
#include <climits>
#include <cstddef>
#include <stdexcept>
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 432635668e4e7..4a7b7410cb346 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -109,6 +109,7 @@
#include <__assert> // all public C++ headers provide the assertion handler
#include <__functional/operations.h>
+#include <__fwd/hash.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 83c6384433ce3..12c9821521354 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -283,7 +283,10 @@ module std [system] {
module is_sorted { private header "__algorithm/is_sorted.h" }
module is_sorted_until { private header "__algorithm/is_sorted_until.h" }
module iter_swap { private header "__algorithm/iter_swap.h" }
- module iterator_operations { private header "__algorithm/iterator_operations.h" }
+ module iterator_operations {
+ private header "__algorithm/iterator_operations.h"
+ export *
+ }
module lexicographical_compare { private header "__algorithm/lexicographical_compare.h" }
module lower_bound { private header "__algorithm/lower_bound.h" }
module make_heap { private header "__algorithm/make_heap.h" }
@@ -686,6 +689,7 @@ module std [system] {
module default_searcher { private header "__functional/default_searcher.h" }
module function { private header "__functional/function.h" }
module hash { private header "__functional/hash.h" }
+ module hash_fwd { private header "__fwd/hash.h" }
module identity { private header "__functional/identity.h" }
module invoke { private header "__functional/invoke.h" }
module is_transparent { private header "__functional/is_transparent.h" }
@@ -1098,122 +1102,131 @@ 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 aligned_storage { private header "__type_traits/aligned_storage.h" }
- module aligned_union { private header "__type_traits/aligned_union.h" }
- module alignment_of { private header "__type_traits/alignment_of.h" }
- module apply_cv { private header "__type_traits/apply_cv.h" }
- module common_reference { private header "__type_traits/common_reference.h" }
- module common_type { private header "__type_traits/common_type.h" }
- module conditional { private header "__type_traits/conditional.h" }
- module conjunction { private header "__type_traits/conjunction.h" }
- module copy_cv { private header "__type_traits/copy_cv.h" }
- module copy_cvref { private header "__type_traits/copy_cvref.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_constructible { private header "__type_traits/is_constructible.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_copy_constructible { private header "__type_traits/is_copy_constructible.h" }
- module is_core_convertible { private header "__type_traits/is_core_convertible.h" }
- module is_default_constructible { private header "__type_traits/is_default_constructible.h" }
- module is_destructible { private header "__type_traits/is_destructible.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_move_constructible { private header "__type_traits/is_move_constructible.h" }
- module is_nothrow_assignable { private header "__type_traits/is_nothrow_assignable.h" }
- module is_nothrow_constructible { private header "__type_traits/is_nothrow_constructible.h" }
- module is_nothrow_convertible { private header "__type_traits/is_nothrow_convertible.h" }
- module is_nothrow_copy_assignable { private header "__type_traits/is_nothrow_copy_assignable.h" }
- module is_nothrow_copy_constructible { private header "__type_traits/is_nothrow_copy_constructible.h" }
- module is_nothrow_default_constructible { private header "__type_traits/is_nothrow_default_constructible.h" }
- module is_nothrow_destructible { private header "__type_traits/is_nothrow_destructible.h" }
- module is_nothrow_move_assignable { private header "__type_traits/is_nothrow_move_assignable.h" }
- module is_nothrow_move_constructible { private header "__type_traits/is_nothrow_move_constructible.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_primary_template { private header "__type_traits/is_primary_template.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_signed_integer { private header "__type_traits/is_signed_integer.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_assignable { private header "__type_traits/is_trivially_assignable.h" }
- module is_trivially_constructible { private header "__type_traits/is_trivially_constructible.h" }
- module is_trivially_copy_assignable { private header "__type_traits/is_trivially_copy_assignable.h" }
- module is_trivially_copy_constructible { private header "__type_traits/is_trivially_copy_constructible.h" }
- module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" }
- module is_trivially_default_constructible { private header "__type_traits/is_trivially_default_constructible.h" }
- module is_trivially_destructible { private header "__type_traits/is_trivially_destructible.h" }
- module is_trivially_move_assignable { private header "__type_traits/is_trivially_move_assignable.h" }
- module is_trivially_move_constructible { private header "__type_traits/is_trivially_move_constructible.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_unsigned_integer { private header "__type_traits/is_unsigned_integer.h" }
- module is_valid_expansion { private header "__type_traits/is_valid_expansion.h" }
- module is_void { private header "__type_traits/is_void.h" }
- module is_volatile { private header "__type_traits/is_volatile.h" }
- module lazy { private header "__type_traits/lazy.h" }
- module make_32_64_or_128_bit { private header "__type_traits/make_32_64_or_128_bit.h" }
- module make_signed { private header "__type_traits/make_signed.h" }
- module make_unsigned { private header "__type_traits/make_unsigned.h" }
- module nat { private header "__type_traits/nat.h" }
- module negation { private header "__type_traits/negation.h" }
- module promote { private header "__type_traits/promote.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_cvref { private header "__type_traits/remove_cvref.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 type_list { private header "__type_traits/type_list.h" }
- module underlying_type { private header "__type_traits/underlying_type.h" }
- module void_t { private header "__type_traits/void_t.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 aligned_storage { private header "__type_traits/aligned_storage.h" }
+ module aligned_union { private header "__type_traits/aligned_union.h" }
+ module alignment_of { private header "__type_traits/alignment_of.h" }
+ module apply_cv { private header "__type_traits/apply_cv.h" }
+ module can_extract_key { private header "__type_traits/can_extract_key.h" }
+ module common_reference { private header "__type_traits/common_reference.h" }
+ module common_type { private header "__type_traits/common_type.h" }
+ module conditional { private header "__type_traits/conditional.h" }
+ module conjunction { private header "__type_traits/conjunction.h" }
+ module copy_cv { private header "__type_traits/copy_cv.h" }
+ module copy_cvref { private header "__type_traits/copy_cvref.h" }
+ module decay { private header "__type_traits/decay.h" }
+ module dependent_type { private header "__type_traits/dependent_type.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_char_like_type { private header "__type_traits/is_char_like_type.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_constructible { private header "__type_traits/is_constructible.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_copy_constructible { private header "__type_traits/is_copy_constructible.h" }
+ module is_core_convertible { private header "__type_traits/is_core_convertible.h" }
+ module is_default_constructible { private header "__type_traits/is_default_constructible.h" }
+ module is_destructible { private header "__type_traits/is_destructible.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_implicitly_default_constructible { private header "__type_traits/is_implicitly_default_constructible.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_move_constructible { private header "__type_traits/is_move_constructible.h" }
+ module is_nothrow_assignable { private header "__type_traits/is_nothrow_assignable.h" }
+ module is_nothrow_constructible { private header "__type_traits/is_nothrow_constructible.h" }
+ module is_nothrow_convertible { private header "__type_traits/is_nothrow_convertible.h" }
+ module is_nothrow_copy_assignable { private header "__type_traits/is_nothrow_copy_assignable.h" }
+ module is_nothrow_copy_constructible { private header "__type_traits/is_nothrow_copy_constructible.h" }
+ module is_nothrow_default_constructible { private header "__type_traits/is_nothrow_default_constructible.h" }
+ module is_nothrow_destructible { private header "__type_traits/is_nothrow_destructible.h" }
+ module is_nothrow_move_assignable { private header "__type_traits/is_nothrow_move_assignable.h" }
+ module is_nothrow_move_constructible { private header "__type_traits/is_nothrow_move_constructible.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_primary_template { private header "__type_traits/is_primary_template.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_signed_integer { private header "__type_traits/is_signed_integer.h" }
+ module is_standard_layout { private header "__type_traits/is_standard_layout.h" }
+ module is_swappable { private header "__type_traits/is_swappable.h" }
+ module is_trivial { private header "__type_traits/is_trivial.h" }
+ module is_trivially_assignable { private header "__type_traits/is_trivially_assignable.h" }
+ module is_trivially_constructible { private header "__type_traits/is_trivially_constructible.h" }
+ module is_trivially_copy_assignable { private header "__type_traits/is_trivially_copy_assignable.h" }
+ module is_trivially_copy_constructible { private header "__type_traits/is_trivially_copy_constructible.h" }
+ module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" }
+ module is_trivially_default_constructible { private header "__type_traits/is_trivially_default_constructible.h" }
+ module is_trivially_destructible { private header "__type_traits/is_trivially_destructible.h" }
+ module is_trivially_move_assignable { private header "__type_traits/is_trivially_move_assignable.h" }
+ module is_trivially_move_constructible { private header "__type_traits/is_trivially_move_constructible.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_unsigned_integer { private header "__type_traits/is_unsigned_integer.h" }
+ module is_valid_expansion { private header "__type_traits/is_valid_expansion.h" }
+ module is_void { private header "__type_traits/is_void.h" }
+ module is_volatile { private header "__type_traits/is_volatile.h" }
+ module lazy { private header "__type_traits/lazy.h" }
+ module make_32_64_or_128_bit { private header "__type_traits/make_32_64_or_128_bit.h" }
+ module make_const_lvalue_ref { private header "__type_traits/make_const_lvalue_ref.h" }
+ module make_signed { private header "__type_traits/make_signed.h" }
+ module make_unsigned { private header "__type_traits/make_unsigned.h" }
+ module maybe_const { private header "__type_traits/maybe_const.h" }
+ module nat { private header "__type_traits/nat.h" }
+ module negation { private header "__type_traits/negation.h" }
+ module promote { private header "__type_traits/promote.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_const_ref { private header "__type_traits/remove_const_ref.h" }
+ module remove_cv { private header "__type_traits/remove_cv.h" }
+ module remove_cvref { private header "__type_traits/remove_cvref.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 result_of { private header "__type_traits/result_of.h" }
+ module type_identity { private header "__type_traits/type_identity.h" }
+ module type_list { private header "__type_traits/type_list.h" }
+ module underlying_type { private header "__type_traits/underlying_type.h" }
+ module void_t { private header "__type_traits/void_t.h" }
}
module typeindex {
header "typeindex"
@@ -1242,6 +1255,7 @@ module std [system] {
module as_const { private header "__utility/as_const.h" }
module auto_cast { private header "__utility/auto_cast.h" }
module cmp { private header "__utility/cmp.h" }
+ module convert_to_integral { private header "__utility/convert_to_integral.h" }
module declval { private header "__utility/declval.h" }
module exchange { private header "__utility/exchange.h" }
module forward { private header "__utility/forward.h" }
@@ -1249,6 +1263,7 @@ module std [system] {
module integer_sequence { private header "__utility/integer_sequence.h" }
module move { private header "__utility/move.h" }
module pair { private header "__utility/pair.h" }
+ module pair_fwd { private header "__fwd/pair.h" }
module piecewise_construct { private header "__utility/piecewise_construct.h" }
module priority_tag { private header "__utility/priority_tag.h" }
module rel_ops { private header "__utility/rel_ops.h" }
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 79527cca58539..3c2e574b16e49 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -209,6 +209,7 @@ template <class... Types>
#include <__memory/allocator_arg_t.h>
#include <__memory/uses_allocator.h>
#include <__tuple>
+#include <__type_traits/maybe_const.h>
#include <__utility/forward.h>
#include <__utility/integer_sequence.h>
#include <__utility/move.h>
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 3a086c595f92f..7587211adaf01 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -419,6 +419,7 @@ namespace std
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__functional/invoke.h>
+#include <__fwd/hash.h> // This is https://llvm.org/PR56938
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_lvalue_reference.h>
@@ -429,11 +430,13 @@ namespace std
#include <__type_traits/aligned_union.h>
#include <__type_traits/alignment_of.h>
#include <__type_traits/apply_cv.h>
+#include <__type_traits/can_extract_key.h>
#include <__type_traits/common_reference.h>
#include <__type_traits/common_type.h>
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/decay.h>
+#include <__type_traits/dependent_type.h>
#include <__type_traits/disjunction.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/extent.h>
@@ -448,6 +451,7 @@ namespace std
#include <__type_traits/is_base_of.h>
#include <__type_traits/is_bounded_array.h>
#include <__type_traits/is_callable.h>
+#include <__type_traits/is_char_like_type.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_compound.h>
#include <__type_traits/is_const.h>
@@ -464,6 +468,7 @@ namespace std
#include <__type_traits/is_floating_point.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_fundamental.h>
+#include <__type_traits/is_implicitly_default_constructible.h>
#include <__type_traits/is_integral.h>
#include <__type_traits/is_literal_type.h>
#include <__type_traits/is_member_function_pointer.h>
@@ -493,6 +498,7 @@ namespace std
#include <__type_traits/is_scoped_enum.h>
#include <__type_traits/is_signed.h>
#include <__type_traits/is_standard_layout.h>
+#include <__type_traits/is_swappable.h>
#include <__type_traits/is_trivial.h>
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_constructible.h>
@@ -508,17 +514,21 @@ namespace std
#include <__type_traits/is_unsigned.h>
#include <__type_traits/is_void.h>
#include <__type_traits/is_volatile.h>
+#include <__type_traits/make_const_lvalue_ref.h>
#include <__type_traits/make_signed.h>
#include <__type_traits/make_unsigned.h>
+#include <__type_traits/maybe_const.h>
#include <__type_traits/negation.h>
#include <__type_traits/rank.h>
#include <__type_traits/remove_all_extents.h>
#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_const_ref.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_extent.h>
#include <__type_traits/remove_pointer.h>
#include <__type_traits/remove_reference.h>
#include <__type_traits/remove_volatile.h>
+#include <__type_traits/result_of.h>
#include <__type_traits/type_identity.h>
#include <__type_traits/underlying_type.h>
#include <__type_traits/void_t.h>
@@ -531,280 +541,4 @@ namespace std
# pragma GCC system_header
#endif
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
-
-// Member detector base
-
-template <class _Tp, bool>
-struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {};
-
-// is_integral
-
-template <class _Tp>
-struct __unconstref {
- typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type;
-};
-
-#ifndef _LIBCPP_CXX03_LANG
-// First of all, we can't implement this check in C++03 mode because the {}
-// default initialization syntax isn't valid.
-// Second, we implement the trait in a funny manner with two defaulted template
-// arguments to workaround Clang's PR43454.
-template <class _Tp>
-void __test_implicit_default_constructible(_Tp);
-
-template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
-struct __is_implicitly_default_constructible
- : false_type
-{ };
-
-template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type>
- : true_type
-{ };
-
-template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type>
- : false_type
-{ };
-#endif // !C++03
-
-// result_of
-
-#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
-
-template <class _Fp, class ..._Args>
-class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
- : public __invoke_of<_Fp, _Args...>
-{
-};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
-#endif // _LIBCPP_STD_VER > 11
-#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-
-// __swappable
-
-template <class _Tp> struct __is_swappable;
-template <class _Tp> struct __is_nothrow_swappable;
-
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Tp>
-using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
-#else
-template <class>
-using __swap_result_t = void;
-#endif
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp>
-swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
- is_nothrow_move_assignable<_Tp>::value);
-
-template<class _Tp, size_t _Np>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-typename enable_if<
- __is_swappable<_Tp>::value
->::type
-swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
-
-namespace __detail
-{
-// ALL generic swap overloads MUST already have a declaration available at this point.
-
-template <class _Tp, class _Up = _Tp,
- bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
-struct __swappable_with
-{
- template <class _LHS, class _RHS>
- static decltype(swap(declval<_LHS>(), declval<_RHS>()))
- __test_swap(int);
- template <class, class>
- static __nat __test_swap(long);
-
- // Extra parens are needed for the C++03 definition of decltype.
- typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
- typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
-
- static const bool value = _IsNotSame<__swap1, __nat>::value
- && _IsNotSame<__swap2, __nat>::value;
-};
-
-template <class _Tp, class _Up>
-struct __swappable_with<_Tp, _Up, false> : false_type {};
-
-template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value>
-struct __nothrow_swappable_with {
- static const bool value =
-#ifndef _LIBCPP_HAS_NO_NOEXCEPT
- noexcept(swap(declval<_Tp>(), declval<_Up>()))
- && noexcept(swap(declval<_Up>(), declval<_Tp>()));
-#else
- false;
-#endif
-};
-
-template <class _Tp, class _Up>
-struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {};
-
-} // namespace __detail
-
-template <class _Tp>
-struct __is_swappable
- : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value>
-{
-};
-
-template <class _Tp>
-struct __is_nothrow_swappable
- : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value>
-{
-};
-
-#if _LIBCPP_STD_VER > 14
-
-template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_swappable_with
- : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value>
-{
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_swappable
- : public conditional<
- __is_referenceable<_Tp>::value,
- is_swappable_with<
- typename add_lvalue_reference<_Tp>::type,
- typename add_lvalue_reference<_Tp>::type>,
- false_type
- >::type
-{
-};
-
-template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
- : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value>
-{
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
- : public conditional<
- __is_referenceable<_Tp>::value,
- is_nothrow_swappable_with<
- typename add_lvalue_reference<_Tp>::type,
- typename add_lvalue_reference<_Tp>::type>,
- false_type
- >::type
-{
-};
-
-template <class _Tp, class _Up>
-inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value;
-
-template <class _Tp>
-inline constexpr bool is_swappable_v = is_swappable<_Tp>::value;
-
-template <class _Tp, class _Up>
-inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value;
-
-template <class _Tp>
-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 __sfinae_underlying_type
-{
- typedef typename underlying_type<_Tp>::type type;
- typedef decltype(((type)1) + 0) __promoted_type;
-};
-
-template <class _Tp>
-struct __sfinae_underlying_type<_Tp, false> {};
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-int __convert_to_integral(int __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-unsigned __convert_to_integral(unsigned __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-long __convert_to_integral(long __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-unsigned long __convert_to_integral(unsigned long __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-long long __convert_to_integral(long long __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
-
-template<typename _Fp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-typename enable_if<is_floating_point<_Fp>::value, long long>::type
- __convert_to_integral(_Fp __val) { return __val; }
-
-#ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-__int128_t __convert_to_integral(__int128_t __val) { return __val; }
-
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
-#endif
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-typename __sfinae_underlying_type<_Tp>::__promoted_type
-__convert_to_integral(_Tp __val) { return __val; }
-
-// These traits are used in __tree and __hash_table
-struct __extract_key_fail_tag {};
-struct __extract_key_self_tag {};
-struct __extract_key_first_tag {};
-
-template <class _ValTy, class _Key,
- class _RawValTy = typename __unconstref<_ValTy>::type>
-struct __can_extract_key
- : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag,
- __extract_key_fail_tag>::type {};
-
-template <class _Pair, class _Key, class _First, class _Second>
-struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
- : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value,
- __extract_key_first_tag, __extract_key_fail_tag>::type {};
-
-// __can_extract_map_key uses true_type/false_type instead of the tags.
-// It returns true if _Key != _ContainerValueTy (the container is a map not a set)
-// and _ValTy == _Key.
-template <class _ValTy, class _Key, class _ContainerValueTy,
- class _RawValTy = typename __unconstref<_ValTy>::type>
-struct __can_extract_map_key
- : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
-
-// This specialization returns __extract_key_fail_tag for non-map containers
-// because _Key == _ContainerValueTy
-template <class _ValTy, class _Key, class _RawValTy>
-struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
- : false_type {};
-
-template <class _CharT>
-using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
-
-template<class _Tp>
-using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&;
-
-template<bool _Const, class _Tp>
-using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type;
-
-_LIBCPP_END_NAMESPACE_STD
-
#endif // _LIBCPP_TYPE_TRAITS
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 765928ad7472f..8a86e4c1aed77 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -206,6 +206,7 @@ namespace std {
#include <__functional/operations.h>
#include <__functional/unary_function.h>
#include <__tuple>
+#include <__type_traits/dependent_type.h>
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp
index a6a07f49e7f3d..029a9674efe2f 100644
--- a/libcxx/test/libcxx/private_headers.verify.cpp
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -364,6 +364,8 @@ END-SCRIPT
#include <__functional/unary_negate.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_negate.h'}}
#include <__functional/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}}
#include <__functional/weak_result_type.h> // expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}}
+#include <__fwd/hash.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/hash.h'}}
+#include <__fwd/pair.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/pair.h'}}
#include <__fwd/span.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/span.h'}}
#include <__fwd/string_view.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string_view.h'}}
#include <__ios/fpos.h> // expected-error@*:* {{use of private header from outside its module: '__ios/fpos.h'}}
@@ -530,6 +532,7 @@ END-SCRIPT
#include <__type_traits/aligned_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/aligned_union.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/can_extract_key.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/can_extract_key.h'}}
#include <__type_traits/common_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_reference.h'}}
#include <__type_traits/common_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_type.h'}}
#include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}}
@@ -537,6 +540,7 @@ END-SCRIPT
#include <__type_traits/copy_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cv.h'}}
#include <__type_traits/copy_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cvref.h'}}
#include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}}
+#include <__type_traits/dependent_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/dependent_type.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'}}
@@ -551,6 +555,7 @@ END-SCRIPT
#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_char_like_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_char_like_type.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'}}
@@ -568,6 +573,7 @@ END-SCRIPT
#include <__type_traits/is_floating_point.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_floating_point.h'}}
#include <__type_traits/is_function.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_function.h'}}
#include <__type_traits/is_fundamental.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_fundamental.h'}}
+#include <__type_traits/is_implicitly_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_implicitly_default_constructible.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'}}
@@ -599,6 +605,7 @@ END-SCRIPT
#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_signed_integer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed_integer.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_swappable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_swappable.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_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_assignable.h'}}
#include <__type_traits/is_trivially_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_constructible.h'}}
@@ -618,20 +625,24 @@ END-SCRIPT
#include <__type_traits/is_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_volatile.h'}}
#include <__type_traits/lazy.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/lazy.h'}}
#include <__type_traits/make_32_64_or_128_bit.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_32_64_or_128_bit.h'}}
+#include <__type_traits/make_const_lvalue_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_const_lvalue_ref.h'}}
#include <__type_traits/make_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_signed.h'}}
#include <__type_traits/make_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_unsigned.h'}}
+#include <__type_traits/maybe_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/maybe_const.h'}}
#include <__type_traits/nat.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/nat.h'}}
#include <__type_traits/negation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/negation.h'}}
#include <__type_traits/promote.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/promote.h'}}
#include <__type_traits/rank.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/rank.h'}}
#include <__type_traits/remove_all_extents.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_all_extents.h'}}
#include <__type_traits/remove_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const.h'}}
+#include <__type_traits/remove_const_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const_ref.h'}}
#include <__type_traits/remove_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cv.h'}}
#include <__type_traits/remove_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cvref.h'}}
#include <__type_traits/remove_extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_extent.h'}}
#include <__type_traits/remove_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_pointer.h'}}
#include <__type_traits/remove_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_reference.h'}}
#include <__type_traits/remove_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_volatile.h'}}
+#include <__type_traits/result_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/result_of.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/type_list.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_list.h'}}
#include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}}
@@ -639,6 +650,7 @@ END-SCRIPT
#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'}}
+#include <__utility/convert_to_integral.h> // expected-error@*:* {{use of private header from outside its module: '__utility/convert_to_integral.h'}}
#include <__utility/declval.h> // expected-error@*:* {{use of private header from outside its module: '__utility/declval.h'}}
#include <__utility/exchange.h> // expected-error@*:* {{use of private header from outside its module: '__utility/exchange.h'}}
#include <__utility/forward.h> // expected-error@*:* {{use of private header from outside its module: '__utility/forward.h'}}
diff --git a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
index fd7db18f2dcee..2972191221642 100644
--- a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
+++ b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
@@ -16,6 +16,10 @@
// Test that the __convert_to_integral functions properly converts Tp to the
// correct type and value for integral, enum and user defined types.
+#include "test_macros.h"
+
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
+#include <__utility/convert_to_integral.h>
#include <limits>
#include <type_traits>
#include <cstdint>
@@ -23,8 +27,6 @@
#include "user_defined_integral.h"
-#include "test_macros.h"
-
template <class T>
struct EnumType
{
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp
index 51671a060d60a..8bfbcd755e39f 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <cassert>
#include <memory>
+#include <utility>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp b/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
index 7da2ee5cbba6e..4d31c38283e2f 100644
--- a/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
+++ b/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
@@ -17,9 +17,11 @@
#include <array>
#include <concepts>
+#include <functional>
#include <iterator>
#include <ranges>
#include <random>
+#include <utility>
#include "test_iterators.h"
More information about the libcxx-commits
mailing list