[libcxx-commits] [libcxx] [libc++][C++03] Remove headers which don't provide anything (PR #134044)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Apr 5 02:50:09 PDT 2025
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/134044
>From c9392069e3999c536411e4f686a96806da73ff9b Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 20 Dec 2024 21:58:38 +0100
Subject: [PATCH] [libc++][C++03] Remove headers which don't provide anything
---
libcxx/include/CMakeLists.txt | 438 ----
libcxx/include/__cxx03/__algorithm/clamp.h | 44 -
libcxx/include/__cxx03/__algorithm/count.h | 2 +-
libcxx/include/__cxx03/__algorithm/equal.h | 3 +-
.../include/__cxx03/__algorithm/equal_range.h | 2 +-
libcxx/include/__cxx03/__algorithm/find.h | 1 -
libcxx/include/__cxx03/__algorithm/find_end.h | 2 +-
libcxx/include/__cxx03/__algorithm/fold.h | 128 --
libcxx/include/__cxx03/__algorithm/for_each.h | 2 -
.../include/__cxx03/__algorithm/for_each_n.h | 41 -
.../__cxx03/__algorithm/in_found_result.h | 54 -
.../__cxx03/__algorithm/in_fun_result.h | 54 -
.../__cxx03/__algorithm/in_in_out_result.h | 59 -
.../__cxx03/__algorithm/in_in_result.h | 56 -
.../__cxx03/__algorithm/in_out_out_result.h | 57 -
.../__cxx03/__algorithm/in_out_result.h | 56 -
libcxx/include/__cxx03/__algorithm/includes.h | 2 +-
.../__cxx03/__algorithm/is_permutation.h | 3 +-
.../__cxx03/__algorithm/iterator_operations.h | 5 -
.../lexicographical_compare_three_way.h | 125 --
.../include/__cxx03/__algorithm/lower_bound.h | 2 +-
.../__cxx03/__algorithm/make_projected.h | 3 +-
libcxx/include/__cxx03/__algorithm/max.h | 1 -
libcxx/include/__cxx03/__algorithm/min.h | 1 -
.../include/__cxx03/__algorithm/min_element.h | 2 +-
.../__cxx03/__algorithm/min_max_result.h | 56 -
libcxx/include/__cxx03/__algorithm/minmax.h | 1 -
.../__cxx03/__algorithm/minmax_element.h | 2 +-
.../__cxx03/__algorithm/partial_sort_copy.h | 2 +-
libcxx/include/__cxx03/__algorithm/pstl.h | 663 ------
.../__algorithm/ranges_adjacent_find.h | 83 -
.../__cxx03/__algorithm/ranges_all_of.h | 74 -
.../__cxx03/__algorithm/ranges_any_of.h | 74 -
.../__algorithm/ranges_binary_search.h | 73 -
.../__cxx03/__algorithm/ranges_clamp.h | 66 -
.../__cxx03/__algorithm/ranges_contains.h | 66 -
.../__algorithm/ranges_contains_subrange.h | 97 -
.../include/__cxx03/__algorithm/ranges_copy.h | 71 -
.../__algorithm/ranges_copy_backward.h | 69 -
.../__cxx03/__algorithm/ranges_copy_if.h | 87 -
.../__cxx03/__algorithm/ranges_copy_n.h | 81 -
.../__cxx03/__algorithm/ranges_count.h | 66 -
.../__cxx03/__algorithm/ranges_count_if.h | 79 -
.../__cxx03/__algorithm/ranges_ends_with.h | 201 --
.../__cxx03/__algorithm/ranges_equal.h | 109 -
.../__cxx03/__algorithm/ranges_equal_range.h | 80 -
.../include/__cxx03/__algorithm/ranges_fill.h | 62 -
.../__cxx03/__algorithm/ranges_fill_n.h | 53 -
.../include/__cxx03/__algorithm/ranges_find.h | 80 -
.../__cxx03/__algorithm/ranges_find_end.h | 103 -
.../__algorithm/ranges_find_first_of.h | 106 -
.../__cxx03/__algorithm/ranges_find_if.h | 75 -
.../__cxx03/__algorithm/ranges_find_if_not.h | 69 -
.../__cxx03/__algorithm/ranges_find_last.h | 175 --
.../__cxx03/__algorithm/ranges_for_each.h | 81 -
.../__cxx03/__algorithm/ranges_for_each_n.h | 64 -
.../__cxx03/__algorithm/ranges_generate.h | 73 -
.../__cxx03/__algorithm/ranges_generate_n.h | 65 -
.../__cxx03/__algorithm/ranges_includes.h | 98 -
.../__algorithm/ranges_inplace_merge.h | 84 -
.../__cxx03/__algorithm/ranges_is_heap.h | 81 -
.../__algorithm/ranges_is_heap_until.h | 81 -
.../__algorithm/ranges_is_partitioned.h | 86 -
.../__algorithm/ranges_is_permutation.h | 107 -
.../__cxx03/__algorithm/ranges_is_sorted.h | 67 -
.../__algorithm/ranges_is_sorted_until.h | 82 -
.../__algorithm/ranges_iterator_concept.h | 56 -
.../ranges_lexicographical_compare.h | 106 -
.../__cxx03/__algorithm/ranges_lower_bound.h | 73 -
.../__cxx03/__algorithm/ranges_make_heap.h | 85 -
.../include/__cxx03/__algorithm/ranges_max.h | 103 -
.../__cxx03/__algorithm/ranges_max_element.h | 69 -
.../__cxx03/__algorithm/ranges_merge.h | 138 --
.../include/__cxx03/__algorithm/ranges_min.h | 95 -
.../__cxx03/__algorithm/ranges_min_element.h | 81 -
.../__cxx03/__algorithm/ranges_minmax.h | 175 --
.../__algorithm/ranges_minmax_element.h | 78 -
.../__cxx03/__algorithm/ranges_mismatch.h | 100 -
.../include/__cxx03/__algorithm/ranges_move.h | 74 -
.../__algorithm/ranges_move_backward.h | 76 -
.../__algorithm/ranges_next_permutation.h | 78 -
.../__cxx03/__algorithm/ranges_none_of.h | 75 -
.../__cxx03/__algorithm/ranges_nth_element.h | 84 -
.../__cxx03/__algorithm/ranges_partial_sort.h | 82 -
.../__algorithm/ranges_partial_sort_copy.h | 114 -
.../__cxx03/__algorithm/ranges_partition.h | 88 -
.../__algorithm/ranges_partition_copy.h | 110 -
.../__algorithm/ranges_partition_point.h | 93 -
.../__cxx03/__algorithm/ranges_pop_heap.h | 86 -
.../__algorithm/ranges_prev_permutation.h | 78 -
.../__cxx03/__algorithm/ranges_push_heap.h | 85 -
.../__cxx03/__algorithm/ranges_remove.h | 68 -
.../__cxx03/__algorithm/ranges_remove_copy.h | 81 -
.../__algorithm/ranges_remove_copy_if.h | 95 -
.../__cxx03/__algorithm/ranges_remove_if.h | 89 -
.../__cxx03/__algorithm/ranges_replace.h | 68 -
.../__cxx03/__algorithm/ranges_replace_copy.h | 93 -
.../__algorithm/ranges_replace_copy_if.h | 98 -
.../__cxx03/__algorithm/ranges_replace_if.h | 81 -
.../__cxx03/__algorithm/ranges_reverse.h | 79 -
.../__cxx03/__algorithm/ranges_reverse_copy.h | 70 -
.../__cxx03/__algorithm/ranges_rotate.h | 71 -
.../__cxx03/__algorithm/ranges_rotate_copy.h | 68 -
.../__cxx03/__algorithm/ranges_sample.h | 74 -
.../__cxx03/__algorithm/ranges_search.h | 134 --
.../__cxx03/__algorithm/ranges_search_n.h | 116 -
.../__algorithm/ranges_set_difference.h | 109 -
.../__algorithm/ranges_set_intersection.h | 114 -
.../ranges_set_symmetric_difference.h | 114 -
.../__cxx03/__algorithm/ranges_set_union.h | 115 -
.../__cxx03/__algorithm/ranges_shuffle.h | 72 -
.../include/__cxx03/__algorithm/ranges_sort.h | 84 -
.../__cxx03/__algorithm/ranges_sort_heap.h | 85 -
.../__algorithm/ranges_stable_partition.h | 92 -
.../__cxx03/__algorithm/ranges_stable_sort.h | 82 -
.../__cxx03/__algorithm/ranges_starts_with.h | 95 -
.../__cxx03/__algorithm/ranges_swap_ranges.h | 70 -
.../__cxx03/__algorithm/ranges_transform.h | 177 --
.../__cxx03/__algorithm/ranges_unique.h | 82 -
.../__cxx03/__algorithm/ranges_unique_copy.h | 120 --
.../__cxx03/__algorithm/ranges_upper_bound.h | 74 -
libcxx/include/__cxx03/__algorithm/sample.h | 123 --
libcxx/include/__cxx03/__algorithm/search.h | 3 +-
libcxx/include/__cxx03/__algorithm/search_n.h | 4 +-
.../__cxx03/__algorithm/set_difference.h | 1 -
.../__cxx03/__algorithm/set_intersection.h | 1 -
.../include/__cxx03/__algorithm/shift_left.h | 59 -
.../include/__cxx03/__algorithm/shift_right.h | 105 -
.../include/__cxx03/__algorithm/simd_utils.h | 1 -
libcxx/include/__cxx03/__algorithm/sort.h | 1 -
.../__cxx03/__algorithm/unwrap_range.h | 2 -
.../include/__cxx03/__algorithm/upper_bound.h | 2 +-
libcxx/include/__cxx03/__atomic/atomic_ref.h | 378 ----
libcxx/include/__cxx03/__bit/bit_cast.h | 44 -
libcxx/include/__cxx03/__bit/bit_ceil.h | 54 -
libcxx/include/__cxx03/__bit/bit_floor.h | 34 -
libcxx/include/__cxx03/__bit/bit_log2.h | 34 -
libcxx/include/__cxx03/__bit/bit_width.h | 33 -
libcxx/include/__cxx03/__bit/byteswap.h | 53 -
libcxx/include/__cxx03/__bit/countl.h | 1 -
libcxx/include/__cxx03/__bit/countr.h | 1 -
libcxx/include/__cxx03/__bit/endian.h | 38 -
libcxx/include/__cxx03/__bit/has_single_bit.h | 37 -
libcxx/include/__cxx03/__bit/invert_if.h | 1 -
libcxx/include/__cxx03/__bit/popcount.h | 1 -
libcxx/include/__cxx03/__bit/rotate.h | 1 -
libcxx/include/__cxx03/__bit_reference | 1 -
.../include/__cxx03/__charconv/chars_format.h | 61 -
.../__cxx03/__charconv/from_chars_integral.h | 240 ---
.../__cxx03/__charconv/from_chars_result.h | 39 -
libcxx/include/__cxx03/__charconv/tables.h | 163 --
libcxx/include/__cxx03/__charconv/to_chars.h | 25 -
.../__cxx03/__charconv/to_chars_base_10.h | 188 --
.../__charconv/to_chars_floating_point.h | 55 -
.../__cxx03/__charconv/to_chars_integral.h | 327 ---
.../__cxx03/__charconv/to_chars_result.h | 39 -
libcxx/include/__cxx03/__charconv/traits.h | 200 --
libcxx/include/__cxx03/__chrono/calendar.h | 44 -
libcxx/include/__cxx03/__chrono/concepts.h | 36 -
.../include/__cxx03/__chrono/convert_to_tm.h | 202 --
libcxx/include/__cxx03/__chrono/day.h | 99 -
libcxx/include/__cxx03/__chrono/duration.h | 2 -
libcxx/include/__cxx03/__chrono/exception.h | 135 --
libcxx/include/__cxx03/__chrono/file_clock.h | 80 -
libcxx/include/__cxx03/__chrono/formatter.h | 990 ---------
libcxx/include/__cxx03/__chrono/hh_mm_ss.h | 112 -
libcxx/include/__cxx03/__chrono/leap_second.h | 126 --
libcxx/include/__cxx03/__chrono/literals.h | 45 -
libcxx/include/__cxx03/__chrono/local_info.h | 50 -
libcxx/include/__cxx03/__chrono/month.h | 115 -
.../include/__cxx03/__chrono/month_weekday.h | 105 -
libcxx/include/__cxx03/__chrono/monthday.h | 133 --
libcxx/include/__cxx03/__chrono/ostream.h | 322 ---
.../__cxx03/__chrono/parser_std_format_spec.h | 416 ----
.../__cxx03/__chrono/statically_widen.h | 52 -
libcxx/include/__cxx03/__chrono/sys_info.h | 51 -
libcxx/include/__cxx03/__chrono/time_point.h | 2 -
libcxx/include/__cxx03/__chrono/time_zone.h | 182 --
.../include/__cxx03/__chrono/time_zone_link.h | 79 -
libcxx/include/__cxx03/__chrono/tzdb.h | 94 -
libcxx/include/__cxx03/__chrono/tzdb_list.h | 108 -
libcxx/include/__cxx03/__chrono/weekday.h | 167 --
libcxx/include/__cxx03/__chrono/year.h | 118 --
libcxx/include/__cxx03/__chrono/year_month.h | 123 --
.../include/__cxx03/__chrono/year_month_day.h | 337 ---
.../__cxx03/__chrono/year_month_weekday.h | 287 ---
libcxx/include/__cxx03/__chrono/zoned_time.h | 227 --
.../__compare/common_comparison_category.h | 86 -
.../compare_partial_order_fallback.h | 76 -
.../__compare/compare_strong_order_fallback.h | 73 -
.../__cxx03/__compare/compare_three_way.h | 40 -
.../__compare/compare_three_way_result.h | 45 -
.../__compare/compare_weak_order_fallback.h | 73 -
libcxx/include/__cxx03/__compare/is_eq.h | 34 -
libcxx/include/__cxx03/__compare/ordering.h | 278 ---
.../include/__cxx03/__compare/partial_order.h | 77 -
.../include/__cxx03/__compare/strong_order.h | 143 --
.../__cxx03/__compare/synth_three_way.h | 52 -
.../__cxx03/__compare/three_way_comparable.h | 55 -
libcxx/include/__cxx03/__compare/weak_order.h | 105 -
.../include/__cxx03/__concepts/arithmetic.h | 56 -
.../include/__cxx03/__concepts/assignable.h | 41 -
.../__cxx03/__concepts/boolean_testable.h | 38 -
.../__cxx03/__concepts/class_or_enum.h | 35 -
.../__concepts/common_reference_with.h | 36 -
.../include/__cxx03/__concepts/common_with.h | 52 -
.../__cxx03/__concepts/constructible.h | 55 -
.../__cxx03/__concepts/convertible_to.h | 33 -
libcxx/include/__cxx03/__concepts/copyable.h | 41 -
.../include/__cxx03/__concepts/derived_from.h | 33 -
.../include/__cxx03/__concepts/destructible.h | 32 -
.../__cxx03/__concepts/different_from.h | 31 -
.../__cxx03/__concepts/equality_comparable.h | 56 -
libcxx/include/__cxx03/__concepts/invocable.h | 40 -
libcxx/include/__cxx03/__concepts/movable.h | 35 -
libcxx/include/__cxx03/__concepts/predicate.h | 34 -
libcxx/include/__cxx03/__concepts/regular.h | 33 -
libcxx/include/__cxx03/__concepts/relation.h | 43 -
libcxx/include/__cxx03/__concepts/same_as.h | 35 -
.../include/__cxx03/__concepts/semiregular.h | 33 -
libcxx/include/__cxx03/__concepts/swappable.h | 123 --
.../__cxx03/__concepts/totally_ordered.h | 59 -
.../__cxx03/__coroutine/coroutine_handle.h | 176 --
.../__cxx03/__coroutine/coroutine_traits.h | 48 -
.../__coroutine/noop_coroutine_handle.h | 99 -
.../__cxx03/__coroutine/trivial_awaitables.h | 40 -
.../__cxx03/__expected/bad_expected_access.h | 73 -
libcxx/include/__cxx03/__expected/expected.h | 1874 -----------------
libcxx/include/__cxx03/__expected/unexpect.h | 32 -
.../include/__cxx03/__expected/unexpected.h | 127 --
.../__cxx03/__filesystem/copy_options.h | 69 -
.../__cxx03/__filesystem/directory_entry.h | 435 ----
.../__cxx03/__filesystem/directory_iterator.h | 151 --
.../__cxx03/__filesystem/directory_options.h | 57 -
.../__cxx03/__filesystem/file_status.h | 67 -
.../__cxx03/__filesystem/file_time_type.h | 31 -
.../include/__cxx03/__filesystem/file_type.h | 42 -
.../__cxx03/__filesystem/filesystem_error.h | 88 -
.../include/__cxx03/__filesystem/operations.h | 310 ---
libcxx/include/__cxx03/__filesystem/path.h | 931 --------
.../__cxx03/__filesystem/path_iterator.h | 115 -
.../__cxx03/__filesystem/perm_options.h | 57 -
libcxx/include/__cxx03/__filesystem/perms.h | 80 -
.../recursive_directory_iterator.h | 164 --
.../include/__cxx03/__filesystem/space_info.h | 38 -
libcxx/include/__cxx03/__filesystem/u8path.h | 100 -
libcxx/include/__cxx03/__format/buffer.h | 655 ------
libcxx/include/__cxx03/__format/concepts.h | 83 -
.../__cxx03/__format/container_adaptor.h | 73 -
.../__cxx03/__format/enable_insertable.h | 35 -
.../__cxx03/__format/escaped_output_table.h | 863 --------
.../extended_grapheme_cluster_table.h | 1663 ---------------
libcxx/include/__cxx03/__format/format_arg.h | 401 ----
.../__cxx03/__format/format_arg_store.h | 266 ---
libcxx/include/__cxx03/__format/format_args.h | 78 -
.../include/__cxx03/__format/format_context.h | 220 --
.../include/__cxx03/__format/format_error.h | 50 -
.../__cxx03/__format/format_functions.h | 680 ------
.../__cxx03/__format/format_parse_context.h | 105 -
.../include/__cxx03/__format/format_string.h | 160 --
.../__cxx03/__format/format_to_n_result.h | 35 -
libcxx/include/__cxx03/__format/formatter.h | 53 -
.../include/__cxx03/__format/formatter_bool.h | 76 -
.../include/__cxx03/__format/formatter_char.h | 93 -
.../__format/formatter_floating_point.h | 783 -------
.../__cxx03/__format/formatter_integer.h | 95 -
.../__cxx03/__format/formatter_integral.h | 445 ----
.../__cxx03/__format/formatter_output.h | 335 ---
.../__cxx03/__format/formatter_pointer.h | 72 -
.../__cxx03/__format/formatter_string.h | 150 --
.../__cxx03/__format/formatter_tuple.h | 150 --
.../__format/indic_conjunct_break_table.h | 350 ---
.../__cxx03/__format/parser_std_format_spec.h | 1172 -----------
.../__format/range_default_formatter.h | 214 --
.../__cxx03/__format/range_formatter.h | 264 ---
libcxx/include/__cxx03/__format/unicode.h | 602 ------
.../__cxx03/__format/width_estimation_table.h | 270 ---
.../include/__cxx03/__format/write_escaped.h | 242 ---
libcxx/include/__cxx03/__functional/bind.h | 4 +-
.../include/__cxx03/__functional/bind_back.h | 83 -
.../include/__cxx03/__functional/bind_front.h | 54 -
.../__functional/boyer_moore_searcher.h | 306 ---
libcxx/include/__cxx03/__functional/compose.h | 53 -
.../__cxx03/__functional/default_searcher.h | 54 -
.../include/__cxx03/__functional/function.h | 1048 ---------
libcxx/include/__cxx03/__functional/invoke.h | 54 -
.../__cxx03/__functional/is_transparent.h | 34 -
libcxx/include/__cxx03/__functional/mem_fn.h | 2 +-
libcxx/include/__cxx03/__functional/not_fn.h | 53 -
.../__cxx03/__functional/perfect_forward.h | 104 -
.../__cxx03/__functional/ranges_operations.h | 109 -
.../__cxx03/__functional/reference_wrapper.h | 4 +-
.../__cxx03/__functional/weak_result_type.h | 2 +-
libcxx/include/__cxx03/__fwd/format.h | 38 -
libcxx/include/__cxx03/__fwd/mdspan.h | 57 -
.../include/__cxx03/__fwd/memory_resource.h | 27 -
libcxx/include/__cxx03/__fwd/span.h | 38 -
libcxx/include/__cxx03/__fwd/string.h | 1 -
libcxx/include/__cxx03/__fwd/subrange.h | 49 -
libcxx/include/__cxx03/__hash_table | 2 -
libcxx/include/__cxx03/__iterator/advance.h | 4 -
.../include/__cxx03/__iterator/bounded_iter.h | 2 -
.../__cxx03/__iterator/common_iterator.h | 299 ---
libcxx/include/__cxx03/__iterator/concepts.h | 257 ---
.../__cxx03/__iterator/counted_iterator.h | 289 ---
libcxx/include/__cxx03/__iterator/data.h | 49 -
.../__cxx03/__iterator/default_sentinel.h | 30 -
libcxx/include/__cxx03/__iterator/distance.h | 5 -
libcxx/include/__cxx03/__iterator/empty.h | 45 -
.../__cxx03/__iterator/incrementable_traits.h | 79 -
.../__iterator/indirectly_comparable.h | 33 -
.../__cxx03/__iterator/insert_iterator.h | 1 -
.../__cxx03/__iterator/istream_iterator.h | 1 -
.../__cxx03/__iterator/istreambuf_iterator.h | 1 -
libcxx/include/__cxx03/__iterator/iter_move.h | 103 -
libcxx/include/__cxx03/__iterator/iter_swap.h | 108 -
.../__cxx03/__iterator/iterator_traits.h | 10 -
.../__cxx03/__iterator/iterator_with_data.h | 105 -
libcxx/include/__cxx03/__iterator/mergeable.h | 42 -
.../__cxx03/__iterator/move_iterator.h | 12 -
.../__cxx03/__iterator/move_sentinel.h | 61 -
libcxx/include/__cxx03/__iterator/next.h | 2 -
.../include/__cxx03/__iterator/permutable.h | 34 -
libcxx/include/__cxx03/__iterator/prev.h | 2 -
libcxx/include/__cxx03/__iterator/projected.h | 53 -
.../__iterator/ranges_iterator_traits.h | 40 -
.../__cxx03/__iterator/readable_traits.h | 81 -
.../__cxx03/__iterator/reverse_access.h | 80 -
.../__cxx03/__iterator/reverse_iterator.h | 11 -
libcxx/include/__cxx03/__iterator/size.h | 59 -
libcxx/include/__cxx03/__iterator/sortable.h | 35 -
.../__cxx03/__iterator/unreachable_sentinel.h | 37 -
libcxx/include/__cxx03/__iterator/wrap_iter.h | 2 -
.../__cxx03/__math/special_functions.h | 84 -
.../__cxx03/__mdspan/default_accessor.h | 66 -
libcxx/include/__cxx03/__mdspan/extents.h | 532 -----
libcxx/include/__cxx03/__mdspan/layout_left.h | 204 --
.../include/__cxx03/__mdspan/layout_right.h | 201 --
.../include/__cxx03/__mdspan/layout_stride.h | 366 ----
libcxx/include/__cxx03/__mdspan/mdspan.h | 319 ---
libcxx/include/__cxx03/__memory/concepts.h | 63 -
libcxx/include/__cxx03/__memory/inout_ptr.h | 109 -
libcxx/include/__cxx03/__memory/out_ptr.h | 101 -
.../__cxx03/__memory/ranges_construct_at.h | 124 --
.../ranges_uninitialized_algorithms.h | 325 ---
libcxx/include/__cxx03/__memory/shared_ptr.h | 2 -
libcxx/include/__cxx03/__memory/unique_ptr.h | 3 -
.../__memory/uses_allocator_construction.h | 247 ---
.../__memory_resource/memory_resource.h | 88 -
.../monotonic_buffer_resource.h | 122 --
.../__memory_resource/polymorphic_allocator.h | 231 --
.../__cxx03/__memory_resource/pool_options.h | 38 -
.../synchronized_pool_resource.h | 92 -
.../unsynchronized_pool_resource.h | 106 -
libcxx/include/__cxx03/__mutex/once_flag.h | 2 +-
libcxx/include/__cxx03/__node_handle | 209 --
.../__cxx03/__numeric/exclusive_scan.h | 58 -
libcxx/include/__cxx03/__numeric/gcd_lcm.h | 132 --
.../__cxx03/__numeric/inclusive_scan.h | 59 -
libcxx/include/__cxx03/__numeric/midpoint.h | 88 -
libcxx/include/__cxx03/__numeric/pstl.h | 174 --
libcxx/include/__cxx03/__numeric/reduce.h | 53 -
.../__cxx03/__numeric/saturation_arithmetic.h | 145 --
.../__numeric/transform_exclusive_scan.h | 42 -
.../__numeric/transform_inclusive_scan.h | 52 -
.../__cxx03/__numeric/transform_reduce.h | 59 -
libcxx/include/__cxx03/__ostream/print.h | 179 --
libcxx/include/__cxx03/__pstl/backend.h | 35 -
libcxx/include/__cxx03/__pstl/backend_fwd.h | 301 ---
.../include/__cxx03/__pstl/backends/default.h | 503 -----
.../__cxx03/__pstl/backends/libdispatch.h | 397 ----
.../include/__cxx03/__pstl/backends/serial.h | 181 --
.../__cxx03/__pstl/backends/std_thread.h | 136 --
.../include/__cxx03/__pstl/cpu_algos/any_of.h | 99 -
.../__cxx03/__pstl/cpu_algos/cpu_traits.h | 86 -
.../include/__cxx03/__pstl/cpu_algos/fill.h | 66 -
.../__cxx03/__pstl/cpu_algos/find_if.h | 137 --
.../__cxx03/__pstl/cpu_algos/for_each.h | 66 -
.../include/__cxx03/__pstl/cpu_algos/merge.h | 85 -
.../__cxx03/__pstl/cpu_algos/stable_sort.h | 47 -
.../__cxx03/__pstl/cpu_algos/transform.h | 153 --
.../__pstl/cpu_algos/transform_reduce.h | 216 --
libcxx/include/__cxx03/__pstl/dispatch.h | 66 -
.../include/__cxx03/__pstl/handle_exception.h | 57 -
.../__cxx03/__random/generate_canonical.h | 1 -
libcxx/include/__cxx03/__random/seed_seq.h | 1 -
.../__random/uniform_random_bit_generator.h | 44 -
libcxx/include/__cxx03/__ranges/access.h | 210 --
libcxx/include/__cxx03/__ranges/all.h | 78 -
.../include/__cxx03/__ranges/as_rvalue_view.h | 142 --
.../include/__cxx03/__ranges/chunk_by_view.h | 235 ---
libcxx/include/__cxx03/__ranges/common_view.h | 142 --
libcxx/include/__cxx03/__ranges/concepts.h | 142 --
.../__ranges/container_compatible_range.h | 33 -
libcxx/include/__cxx03/__ranges/counted.h | 89 -
libcxx/include/__cxx03/__ranges/dangling.h | 42 -
libcxx/include/__cxx03/__ranges/data.h | 102 -
libcxx/include/__cxx03/__ranges/drop_view.h | 329 ---
.../__cxx03/__ranges/drop_while_view.h | 136 --
.../include/__cxx03/__ranges/elements_view.h | 418 ----
libcxx/include/__cxx03/__ranges/empty.h | 71 -
libcxx/include/__cxx03/__ranges/empty_view.h | 54 -
.../__cxx03/__ranges/enable_borrowed_range.h | 40 -
libcxx/include/__cxx03/__ranges/enable_view.h | 51 -
libcxx/include/__cxx03/__ranges/filter_view.h | 260 ---
libcxx/include/__cxx03/__ranges/from_range.h | 33 -
libcxx/include/__cxx03/__ranges/iota_view.h | 404 ----
.../include/__cxx03/__ranges/istream_view.h | 141 --
libcxx/include/__cxx03/__ranges/join_view.h | 423 ----
.../__cxx03/__ranges/lazy_split_view.h | 441 ----
libcxx/include/__cxx03/__ranges/movable_box.h | 247 ---
.../__cxx03/__ranges/non_propagating_cache.h | 103 -
libcxx/include/__cxx03/__ranges/owning_view.h | 116 -
.../include/__cxx03/__ranges/range_adaptor.h | 101 -
libcxx/include/__cxx03/__ranges/rbegin.h | 120 --
libcxx/include/__cxx03/__ranges/ref_view.h | 89 -
libcxx/include/__cxx03/__ranges/rend.h | 123 --
libcxx/include/__cxx03/__ranges/repeat_view.h | 266 ---
.../include/__cxx03/__ranges/reverse_view.h | 203 --
libcxx/include/__cxx03/__ranges/single_view.h | 111 -
libcxx/include/__cxx03/__ranges/size.h | 137 --
libcxx/include/__cxx03/__ranges/split_view.h | 232 --
libcxx/include/__cxx03/__ranges/subrange.h | 273 ---
libcxx/include/__cxx03/__ranges/take_view.h | 369 ----
.../__cxx03/__ranges/take_while_view.h | 170 --
libcxx/include/__cxx03/__ranges/to.h | 245 ---
.../include/__cxx03/__ranges/transform_view.h | 417 ----
.../include/__cxx03/__ranges/view_interface.h | 170 --
libcxx/include/__cxx03/__ranges/views.h | 35 -
libcxx/include/__cxx03/__ranges/zip_view.h | 516 -----
.../__cxx03/__stop_token/atomic_unique_lock.h | 140 --
.../__stop_token/intrusive_list_view.h | 85 -
.../__stop_token/intrusive_shared_ptr.h | 134 --
.../__cxx03/__stop_token/stop_callback.h | 102 -
.../__cxx03/__stop_token/stop_source.h | 91 -
.../include/__cxx03/__stop_token/stop_state.h | 236 ---
.../include/__cxx03/__stop_token/stop_token.h | 63 -
libcxx/include/__cxx03/__string/char_traits.h | 1 -
.../__cxx03/__system_error/error_category.h | 1 -
.../__cxx03/__system_error/error_code.h | 1 -
.../__cxx03/__system_error/error_condition.h | 1 -
libcxx/include/__cxx03/__thread/formatter.h | 80 -
libcxx/include/__cxx03/__thread/id.h | 1 -
libcxx/include/__cxx03/__thread/jthread.h | 134 --
libcxx/include/__cxx03/__thread/thread.h | 1 -
libcxx/include/__cxx03/__tree | 2 +-
libcxx/include/__cxx03/__tuple/ignore.h | 39 -
.../__cxx03/__type_traits/common_reference.h | 193 --
.../has_unique_object_representation.h | 40 -
.../__cxx03/__type_traits/is_aggregate.h | 33 -
.../__type_traits/is_nothrow_convertible.h | 62 -
.../include/__cxx03/__type_traits/result_of.h | 2 +-
libcxx/include/__cxx03/__utility/as_const.h | 35 -
libcxx/include/__cxx03/__utility/cmp.h | 81 -
.../__cxx03/__utility/exception_guard.h | 1 -
libcxx/include/__cxx03/__utility/exchange.h | 41 -
.../include/__cxx03/__utility/forward_like.h | 46 -
libcxx/include/__cxx03/__utility/in_place.h | 63 -
libcxx/include/__cxx03/__utility/pair.h | 4 -
.../include/__cxx03/__utility/to_underlying.h | 38 -
libcxx/include/__cxx03/algorithm | 121 --
libcxx/include/__cxx03/any | 614 ------
libcxx/include/__cxx03/array | 10 -
libcxx/include/__cxx03/atomic | 5 -
libcxx/include/__cxx03/barrier | 308 ---
libcxx/include/__cxx03/bit | 101 -
libcxx/include/__cxx03/bitset | 1 -
libcxx/include/__cxx03/charconv | 115 -
libcxx/include/__cxx03/chrono | 44 -
libcxx/include/__cxx03/cmath | 1 -
libcxx/include/__cxx03/codecvt | 2 -
libcxx/include/__cxx03/compare | 178 --
libcxx/include/__cxx03/concepts | 173 --
libcxx/include/__cxx03/condition_variable | 4 -
libcxx/include/__cxx03/coroutine | 67 -
libcxx/include/__cxx03/deque | 17 -
libcxx/include/__cxx03/execution | 149 --
libcxx/include/__cxx03/expected | 62 -
.../__cxx03/experimental/__simd/aligned_tag.h | 75 -
.../__cxx03/experimental/__simd/declaration.h | 81 -
.../__cxx03/experimental/__simd/reference.h | 105 -
.../__cxx03/experimental/__simd/scalar.h | 87 -
.../__cxx03/experimental/__simd/simd.h | 102 -
.../__cxx03/experimental/__simd/simd_mask.h | 90 -
.../__cxx03/experimental/__simd/traits.h | 75 -
.../__cxx03/experimental/__simd/utility.h | 103 -
.../__cxx03/experimental/__simd/vec_ext.h | 119 --
libcxx/include/__cxx03/experimental/iterator | 127 --
libcxx/include/__cxx03/experimental/memory | 198 --
.../__cxx03/experimental/propagate_const | 490 -----
libcxx/include/__cxx03/experimental/simd | 88 -
.../include/__cxx03/experimental/type_traits | 153 --
libcxx/include/__cxx03/experimental/utility | 6 -
libcxx/include/__cxx03/ext/hash_map | 1 -
libcxx/include/__cxx03/ext/hash_set | 1 -
libcxx/include/__cxx03/filesystem | 577 -----
libcxx/include/__cxx03/format | 257 ---
libcxx/include/__cxx03/forward_list | 15 -
libcxx/include/__cxx03/fstream | 2 -
libcxx/include/__cxx03/functional | 17 -
libcxx/include/__cxx03/initializer_list | 98 -
libcxx/include/__cxx03/ios | 2 -
libcxx/include/__cxx03/istream | 1 -
libcxx/include/__cxx03/iterator | 36 -
libcxx/include/__cxx03/latch | 129 --
libcxx/include/__cxx03/list | 16 -
libcxx/include/__cxx03/locale | 1 -
libcxx/include/__cxx03/map | 17 -
libcxx/include/__cxx03/mdspan | 438 ----
libcxx/include/__cxx03/memory | 11 -
libcxx/include/__cxx03/memory_resource | 83 -
libcxx/include/__cxx03/mutex | 2 -
libcxx/include/__cxx03/numbers | 164 --
libcxx/include/__cxx03/numeric | 20 -
libcxx/include/__cxx03/optional | 1304 ------------
libcxx/include/__cxx03/ostream | 3 -
libcxx/include/__cxx03/print | 402 ----
libcxx/include/__cxx03/queue | 12 -
libcxx/include/__cxx03/random | 7 -
libcxx/include/__cxx03/ranges | 463 ----
libcxx/include/__cxx03/regex | 11 -
libcxx/include/__cxx03/scoped_allocator | 573 -----
libcxx/include/__cxx03/semaphore | 188 --
libcxx/include/__cxx03/set | 16 -
libcxx/include/__cxx03/shared_mutex | 464 ----
libcxx/include/__cxx03/source_location | 85 -
libcxx/include/__cxx03/span | 636 ------
libcxx/include/__cxx03/stack | 12 -
libcxx/include/__cxx03/stop_token | 56 -
libcxx/include/__cxx03/string | 16 -
libcxx/include/__cxx03/string_view | 14 -
libcxx/include/__cxx03/syncstream | 512 -----
libcxx/include/__cxx03/system_error | 5 -
libcxx/include/__cxx03/thread | 7 -
libcxx/include/__cxx03/tuple | 1419 -------------
libcxx/include/__cxx03/type_traits | 4 -
libcxx/include/__cxx03/typeindex | 3 -
libcxx/include/__cxx03/unordered_map | 17 -
libcxx/include/__cxx03/unordered_set | 16 -
libcxx/include/__cxx03/utility | 20 -
libcxx/include/__cxx03/valarray | 6 -
libcxx/include/__cxx03/variant | 1650 ---------------
libcxx/include/__cxx03/vector | 21 -
libcxx/include/any | 2 +-
libcxx/include/barrier | 2 +-
libcxx/include/bit | 2 +-
libcxx/include/charconv | 2 +-
libcxx/include/compare | 2 +-
libcxx/include/concepts | 2 +-
libcxx/include/coroutine | 2 +-
libcxx/include/execution | 2 +-
libcxx/include/expected | 2 +-
libcxx/include/experimental/iterator | 2 +-
libcxx/include/experimental/memory | 2 +-
libcxx/include/experimental/propagate_const | 2 +-
libcxx/include/experimental/simd | 2 +-
libcxx/include/experimental/type_traits | 2 +-
libcxx/include/experimental/utility | 2 +-
libcxx/include/filesystem | 2 +-
libcxx/include/format | 2 +-
libcxx/include/initializer_list | 2 +-
libcxx/include/latch | 2 +-
libcxx/include/mdspan | 2 +-
libcxx/include/memory_resource | 2 +-
libcxx/include/numbers | 2 +-
libcxx/include/optional | 2 +-
libcxx/include/print | 2 +-
libcxx/include/ranges | 2 +-
libcxx/include/scoped_allocator | 2 +-
libcxx/include/semaphore | 2 +-
libcxx/include/shared_mutex | 2 +-
libcxx/include/source_location | 2 +-
libcxx/include/span | 2 +-
libcxx/include/stop_token | 2 +-
libcxx/include/syncstream | 2 +-
libcxx/include/tuple | 2 +-
libcxx/include/variant | 2 +-
577 files changed, 56 insertions(+), 70247 deletions(-)
delete mode 100644 libcxx/include/__cxx03/__algorithm/clamp.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/fold.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/for_each_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_found_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_fun_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_in_out_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_in_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_out_out_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/in_out_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/lexicographical_compare_three_way.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/min_max_result.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/pstl.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_adjacent_find.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_all_of.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_any_of.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_binary_search.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_clamp.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_contains.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_contains_subrange.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_copy_backward.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_copy_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_copy_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_count.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_count_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_ends_with.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_equal.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_equal_range.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_fill.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_fill_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find_end.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find_first_of.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find_if_not.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_find_last.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_for_each.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_for_each_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_generate.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_generate_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_includes.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_inplace_merge.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_heap.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_heap_until.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_partitioned.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_permutation.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_sorted.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_is_sorted_until.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_iterator_concept.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_lexicographical_compare.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_lower_bound.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_make_heap.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_max.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_max_element.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_merge.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_min.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_min_element.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_minmax.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_minmax_element.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_mismatch.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_move.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_move_backward.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_next_permutation.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_none_of.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_nth_element.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_partial_sort.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_partial_sort_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_partition.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_partition_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_partition_point.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_pop_heap.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_prev_permutation.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_push_heap.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_remove.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_remove_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_remove_copy_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_remove_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_replace.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_replace_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_replace_copy_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_replace_if.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_reverse.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_reverse_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_rotate.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_rotate_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_sample.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_search.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_search_n.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_set_difference.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_set_intersection.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_set_symmetric_difference.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_set_union.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_shuffle.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_sort.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_sort_heap.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_stable_partition.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_stable_sort.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_starts_with.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_swap_ranges.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_transform.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_unique.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_unique_copy.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/ranges_upper_bound.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/sample.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/shift_left.h
delete mode 100644 libcxx/include/__cxx03/__algorithm/shift_right.h
delete mode 100644 libcxx/include/__cxx03/__atomic/atomic_ref.h
delete mode 100644 libcxx/include/__cxx03/__bit/bit_cast.h
delete mode 100644 libcxx/include/__cxx03/__bit/bit_ceil.h
delete mode 100644 libcxx/include/__cxx03/__bit/bit_floor.h
delete mode 100644 libcxx/include/__cxx03/__bit/bit_log2.h
delete mode 100644 libcxx/include/__cxx03/__bit/bit_width.h
delete mode 100644 libcxx/include/__cxx03/__bit/byteswap.h
delete mode 100644 libcxx/include/__cxx03/__bit/endian.h
delete mode 100644 libcxx/include/__cxx03/__bit/has_single_bit.h
delete mode 100644 libcxx/include/__cxx03/__charconv/chars_format.h
delete mode 100644 libcxx/include/__cxx03/__charconv/from_chars_integral.h
delete mode 100644 libcxx/include/__cxx03/__charconv/from_chars_result.h
delete mode 100644 libcxx/include/__cxx03/__charconv/tables.h
delete mode 100644 libcxx/include/__cxx03/__charconv/to_chars.h
delete mode 100644 libcxx/include/__cxx03/__charconv/to_chars_base_10.h
delete mode 100644 libcxx/include/__cxx03/__charconv/to_chars_floating_point.h
delete mode 100644 libcxx/include/__cxx03/__charconv/to_chars_integral.h
delete mode 100644 libcxx/include/__cxx03/__charconv/to_chars_result.h
delete mode 100644 libcxx/include/__cxx03/__charconv/traits.h
delete mode 100644 libcxx/include/__cxx03/__chrono/calendar.h
delete mode 100644 libcxx/include/__cxx03/__chrono/concepts.h
delete mode 100644 libcxx/include/__cxx03/__chrono/convert_to_tm.h
delete mode 100644 libcxx/include/__cxx03/__chrono/day.h
delete mode 100644 libcxx/include/__cxx03/__chrono/exception.h
delete mode 100644 libcxx/include/__cxx03/__chrono/file_clock.h
delete mode 100644 libcxx/include/__cxx03/__chrono/formatter.h
delete mode 100644 libcxx/include/__cxx03/__chrono/hh_mm_ss.h
delete mode 100644 libcxx/include/__cxx03/__chrono/leap_second.h
delete mode 100644 libcxx/include/__cxx03/__chrono/literals.h
delete mode 100644 libcxx/include/__cxx03/__chrono/local_info.h
delete mode 100644 libcxx/include/__cxx03/__chrono/month.h
delete mode 100644 libcxx/include/__cxx03/__chrono/month_weekday.h
delete mode 100644 libcxx/include/__cxx03/__chrono/monthday.h
delete mode 100644 libcxx/include/__cxx03/__chrono/ostream.h
delete mode 100644 libcxx/include/__cxx03/__chrono/parser_std_format_spec.h
delete mode 100644 libcxx/include/__cxx03/__chrono/statically_widen.h
delete mode 100644 libcxx/include/__cxx03/__chrono/sys_info.h
delete mode 100644 libcxx/include/__cxx03/__chrono/time_zone.h
delete mode 100644 libcxx/include/__cxx03/__chrono/time_zone_link.h
delete mode 100644 libcxx/include/__cxx03/__chrono/tzdb.h
delete mode 100644 libcxx/include/__cxx03/__chrono/tzdb_list.h
delete mode 100644 libcxx/include/__cxx03/__chrono/weekday.h
delete mode 100644 libcxx/include/__cxx03/__chrono/year.h
delete mode 100644 libcxx/include/__cxx03/__chrono/year_month.h
delete mode 100644 libcxx/include/__cxx03/__chrono/year_month_day.h
delete mode 100644 libcxx/include/__cxx03/__chrono/year_month_weekday.h
delete mode 100644 libcxx/include/__cxx03/__chrono/zoned_time.h
delete mode 100644 libcxx/include/__cxx03/__compare/common_comparison_category.h
delete mode 100644 libcxx/include/__cxx03/__compare/compare_partial_order_fallback.h
delete mode 100644 libcxx/include/__cxx03/__compare/compare_strong_order_fallback.h
delete mode 100644 libcxx/include/__cxx03/__compare/compare_three_way.h
delete mode 100644 libcxx/include/__cxx03/__compare/compare_three_way_result.h
delete mode 100644 libcxx/include/__cxx03/__compare/compare_weak_order_fallback.h
delete mode 100644 libcxx/include/__cxx03/__compare/is_eq.h
delete mode 100644 libcxx/include/__cxx03/__compare/ordering.h
delete mode 100644 libcxx/include/__cxx03/__compare/partial_order.h
delete mode 100644 libcxx/include/__cxx03/__compare/strong_order.h
delete mode 100644 libcxx/include/__cxx03/__compare/synth_three_way.h
delete mode 100644 libcxx/include/__cxx03/__compare/three_way_comparable.h
delete mode 100644 libcxx/include/__cxx03/__compare/weak_order.h
delete mode 100644 libcxx/include/__cxx03/__concepts/arithmetic.h
delete mode 100644 libcxx/include/__cxx03/__concepts/assignable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/boolean_testable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/class_or_enum.h
delete mode 100644 libcxx/include/__cxx03/__concepts/common_reference_with.h
delete mode 100644 libcxx/include/__cxx03/__concepts/common_with.h
delete mode 100644 libcxx/include/__cxx03/__concepts/constructible.h
delete mode 100644 libcxx/include/__cxx03/__concepts/convertible_to.h
delete mode 100644 libcxx/include/__cxx03/__concepts/copyable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/derived_from.h
delete mode 100644 libcxx/include/__cxx03/__concepts/destructible.h
delete mode 100644 libcxx/include/__cxx03/__concepts/different_from.h
delete mode 100644 libcxx/include/__cxx03/__concepts/equality_comparable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/invocable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/movable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/predicate.h
delete mode 100644 libcxx/include/__cxx03/__concepts/regular.h
delete mode 100644 libcxx/include/__cxx03/__concepts/relation.h
delete mode 100644 libcxx/include/__cxx03/__concepts/same_as.h
delete mode 100644 libcxx/include/__cxx03/__concepts/semiregular.h
delete mode 100644 libcxx/include/__cxx03/__concepts/swappable.h
delete mode 100644 libcxx/include/__cxx03/__concepts/totally_ordered.h
delete mode 100644 libcxx/include/__cxx03/__coroutine/coroutine_handle.h
delete mode 100644 libcxx/include/__cxx03/__coroutine/coroutine_traits.h
delete mode 100644 libcxx/include/__cxx03/__coroutine/noop_coroutine_handle.h
delete mode 100644 libcxx/include/__cxx03/__coroutine/trivial_awaitables.h
delete mode 100644 libcxx/include/__cxx03/__expected/bad_expected_access.h
delete mode 100644 libcxx/include/__cxx03/__expected/expected.h
delete mode 100644 libcxx/include/__cxx03/__expected/unexpect.h
delete mode 100644 libcxx/include/__cxx03/__expected/unexpected.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/copy_options.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/directory_entry.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/directory_iterator.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/directory_options.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/file_status.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/file_time_type.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/file_type.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/filesystem_error.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/operations.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/path.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/path_iterator.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/perm_options.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/perms.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/recursive_directory_iterator.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/space_info.h
delete mode 100644 libcxx/include/__cxx03/__filesystem/u8path.h
delete mode 100644 libcxx/include/__cxx03/__format/buffer.h
delete mode 100644 libcxx/include/__cxx03/__format/concepts.h
delete mode 100644 libcxx/include/__cxx03/__format/container_adaptor.h
delete mode 100644 libcxx/include/__cxx03/__format/enable_insertable.h
delete mode 100644 libcxx/include/__cxx03/__format/escaped_output_table.h
delete mode 100644 libcxx/include/__cxx03/__format/extended_grapheme_cluster_table.h
delete mode 100644 libcxx/include/__cxx03/__format/format_arg.h
delete mode 100644 libcxx/include/__cxx03/__format/format_arg_store.h
delete mode 100644 libcxx/include/__cxx03/__format/format_args.h
delete mode 100644 libcxx/include/__cxx03/__format/format_context.h
delete mode 100644 libcxx/include/__cxx03/__format/format_error.h
delete mode 100644 libcxx/include/__cxx03/__format/format_functions.h
delete mode 100644 libcxx/include/__cxx03/__format/format_parse_context.h
delete mode 100644 libcxx/include/__cxx03/__format/format_string.h
delete mode 100644 libcxx/include/__cxx03/__format/format_to_n_result.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_bool.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_char.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_floating_point.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_integer.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_integral.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_output.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_pointer.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_string.h
delete mode 100644 libcxx/include/__cxx03/__format/formatter_tuple.h
delete mode 100644 libcxx/include/__cxx03/__format/indic_conjunct_break_table.h
delete mode 100644 libcxx/include/__cxx03/__format/parser_std_format_spec.h
delete mode 100644 libcxx/include/__cxx03/__format/range_default_formatter.h
delete mode 100644 libcxx/include/__cxx03/__format/range_formatter.h
delete mode 100644 libcxx/include/__cxx03/__format/unicode.h
delete mode 100644 libcxx/include/__cxx03/__format/width_estimation_table.h
delete mode 100644 libcxx/include/__cxx03/__format/write_escaped.h
delete mode 100644 libcxx/include/__cxx03/__functional/bind_back.h
delete mode 100644 libcxx/include/__cxx03/__functional/bind_front.h
delete mode 100644 libcxx/include/__cxx03/__functional/boyer_moore_searcher.h
delete mode 100644 libcxx/include/__cxx03/__functional/compose.h
delete mode 100644 libcxx/include/__cxx03/__functional/default_searcher.h
delete mode 100644 libcxx/include/__cxx03/__functional/function.h
delete mode 100644 libcxx/include/__cxx03/__functional/invoke.h
delete mode 100644 libcxx/include/__cxx03/__functional/is_transparent.h
delete mode 100644 libcxx/include/__cxx03/__functional/not_fn.h
delete mode 100644 libcxx/include/__cxx03/__functional/perfect_forward.h
delete mode 100644 libcxx/include/__cxx03/__functional/ranges_operations.h
delete mode 100644 libcxx/include/__cxx03/__fwd/format.h
delete mode 100644 libcxx/include/__cxx03/__fwd/mdspan.h
delete mode 100644 libcxx/include/__cxx03/__fwd/memory_resource.h
delete mode 100644 libcxx/include/__cxx03/__fwd/span.h
delete mode 100644 libcxx/include/__cxx03/__fwd/subrange.h
delete mode 100644 libcxx/include/__cxx03/__iterator/common_iterator.h
delete mode 100644 libcxx/include/__cxx03/__iterator/concepts.h
delete mode 100644 libcxx/include/__cxx03/__iterator/counted_iterator.h
delete mode 100644 libcxx/include/__cxx03/__iterator/data.h
delete mode 100644 libcxx/include/__cxx03/__iterator/default_sentinel.h
delete mode 100644 libcxx/include/__cxx03/__iterator/empty.h
delete mode 100644 libcxx/include/__cxx03/__iterator/incrementable_traits.h
delete mode 100644 libcxx/include/__cxx03/__iterator/indirectly_comparable.h
delete mode 100644 libcxx/include/__cxx03/__iterator/iter_move.h
delete mode 100644 libcxx/include/__cxx03/__iterator/iter_swap.h
delete mode 100644 libcxx/include/__cxx03/__iterator/iterator_with_data.h
delete mode 100644 libcxx/include/__cxx03/__iterator/mergeable.h
delete mode 100644 libcxx/include/__cxx03/__iterator/move_sentinel.h
delete mode 100644 libcxx/include/__cxx03/__iterator/permutable.h
delete mode 100644 libcxx/include/__cxx03/__iterator/projected.h
delete mode 100644 libcxx/include/__cxx03/__iterator/ranges_iterator_traits.h
delete mode 100644 libcxx/include/__cxx03/__iterator/readable_traits.h
delete mode 100644 libcxx/include/__cxx03/__iterator/reverse_access.h
delete mode 100644 libcxx/include/__cxx03/__iterator/size.h
delete mode 100644 libcxx/include/__cxx03/__iterator/sortable.h
delete mode 100644 libcxx/include/__cxx03/__iterator/unreachable_sentinel.h
delete mode 100644 libcxx/include/__cxx03/__math/special_functions.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/default_accessor.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/extents.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/layout_left.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/layout_right.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/layout_stride.h
delete mode 100644 libcxx/include/__cxx03/__mdspan/mdspan.h
delete mode 100644 libcxx/include/__cxx03/__memory/concepts.h
delete mode 100644 libcxx/include/__cxx03/__memory/inout_ptr.h
delete mode 100644 libcxx/include/__cxx03/__memory/out_ptr.h
delete mode 100644 libcxx/include/__cxx03/__memory/ranges_construct_at.h
delete mode 100644 libcxx/include/__cxx03/__memory/ranges_uninitialized_algorithms.h
delete mode 100644 libcxx/include/__cxx03/__memory/uses_allocator_construction.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/memory_resource.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/monotonic_buffer_resource.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/polymorphic_allocator.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/pool_options.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/synchronized_pool_resource.h
delete mode 100644 libcxx/include/__cxx03/__memory_resource/unsynchronized_pool_resource.h
delete mode 100644 libcxx/include/__cxx03/__node_handle
delete mode 100644 libcxx/include/__cxx03/__numeric/exclusive_scan.h
delete mode 100644 libcxx/include/__cxx03/__numeric/gcd_lcm.h
delete mode 100644 libcxx/include/__cxx03/__numeric/inclusive_scan.h
delete mode 100644 libcxx/include/__cxx03/__numeric/midpoint.h
delete mode 100644 libcxx/include/__cxx03/__numeric/pstl.h
delete mode 100644 libcxx/include/__cxx03/__numeric/reduce.h
delete mode 100644 libcxx/include/__cxx03/__numeric/saturation_arithmetic.h
delete mode 100644 libcxx/include/__cxx03/__numeric/transform_exclusive_scan.h
delete mode 100644 libcxx/include/__cxx03/__numeric/transform_inclusive_scan.h
delete mode 100644 libcxx/include/__cxx03/__numeric/transform_reduce.h
delete mode 100644 libcxx/include/__cxx03/__ostream/print.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backend.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backend_fwd.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backends/default.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backends/libdispatch.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backends/serial.h
delete mode 100644 libcxx/include/__cxx03/__pstl/backends/std_thread.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/any_of.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/cpu_traits.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/fill.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/find_if.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/for_each.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/merge.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/stable_sort.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/transform.h
delete mode 100644 libcxx/include/__cxx03/__pstl/cpu_algos/transform_reduce.h
delete mode 100644 libcxx/include/__cxx03/__pstl/dispatch.h
delete mode 100644 libcxx/include/__cxx03/__pstl/handle_exception.h
delete mode 100644 libcxx/include/__cxx03/__random/uniform_random_bit_generator.h
delete mode 100644 libcxx/include/__cxx03/__ranges/access.h
delete mode 100644 libcxx/include/__cxx03/__ranges/all.h
delete mode 100644 libcxx/include/__cxx03/__ranges/as_rvalue_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/chunk_by_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/common_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/concepts.h
delete mode 100644 libcxx/include/__cxx03/__ranges/container_compatible_range.h
delete mode 100644 libcxx/include/__cxx03/__ranges/counted.h
delete mode 100644 libcxx/include/__cxx03/__ranges/dangling.h
delete mode 100644 libcxx/include/__cxx03/__ranges/data.h
delete mode 100644 libcxx/include/__cxx03/__ranges/drop_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/drop_while_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/elements_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/empty.h
delete mode 100644 libcxx/include/__cxx03/__ranges/empty_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/enable_borrowed_range.h
delete mode 100644 libcxx/include/__cxx03/__ranges/enable_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/filter_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/from_range.h
delete mode 100644 libcxx/include/__cxx03/__ranges/iota_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/istream_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/join_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/lazy_split_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/movable_box.h
delete mode 100644 libcxx/include/__cxx03/__ranges/non_propagating_cache.h
delete mode 100644 libcxx/include/__cxx03/__ranges/owning_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/range_adaptor.h
delete mode 100644 libcxx/include/__cxx03/__ranges/rbegin.h
delete mode 100644 libcxx/include/__cxx03/__ranges/ref_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/rend.h
delete mode 100644 libcxx/include/__cxx03/__ranges/repeat_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/reverse_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/single_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/size.h
delete mode 100644 libcxx/include/__cxx03/__ranges/split_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/subrange.h
delete mode 100644 libcxx/include/__cxx03/__ranges/take_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/take_while_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/to.h
delete mode 100644 libcxx/include/__cxx03/__ranges/transform_view.h
delete mode 100644 libcxx/include/__cxx03/__ranges/view_interface.h
delete mode 100644 libcxx/include/__cxx03/__ranges/views.h
delete mode 100644 libcxx/include/__cxx03/__ranges/zip_view.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/atomic_unique_lock.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/intrusive_list_view.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/intrusive_shared_ptr.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/stop_callback.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/stop_source.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/stop_state.h
delete mode 100644 libcxx/include/__cxx03/__stop_token/stop_token.h
delete mode 100644 libcxx/include/__cxx03/__thread/formatter.h
delete mode 100644 libcxx/include/__cxx03/__thread/jthread.h
delete mode 100644 libcxx/include/__cxx03/__tuple/ignore.h
delete mode 100644 libcxx/include/__cxx03/__type_traits/common_reference.h
delete mode 100644 libcxx/include/__cxx03/__type_traits/has_unique_object_representation.h
delete mode 100644 libcxx/include/__cxx03/__type_traits/is_aggregate.h
delete mode 100644 libcxx/include/__cxx03/__type_traits/is_nothrow_convertible.h
delete mode 100644 libcxx/include/__cxx03/__utility/as_const.h
delete mode 100644 libcxx/include/__cxx03/__utility/cmp.h
delete mode 100644 libcxx/include/__cxx03/__utility/exchange.h
delete mode 100644 libcxx/include/__cxx03/__utility/forward_like.h
delete mode 100644 libcxx/include/__cxx03/__utility/in_place.h
delete mode 100644 libcxx/include/__cxx03/__utility/to_underlying.h
delete mode 100644 libcxx/include/__cxx03/any
delete mode 100644 libcxx/include/__cxx03/barrier
delete mode 100644 libcxx/include/__cxx03/bit
delete mode 100644 libcxx/include/__cxx03/charconv
delete mode 100644 libcxx/include/__cxx03/compare
delete mode 100644 libcxx/include/__cxx03/concepts
delete mode 100644 libcxx/include/__cxx03/coroutine
delete mode 100644 libcxx/include/__cxx03/execution
delete mode 100644 libcxx/include/__cxx03/expected
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/aligned_tag.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/declaration.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/reference.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/scalar.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/simd.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/simd_mask.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/traits.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/utility.h
delete mode 100644 libcxx/include/__cxx03/experimental/__simd/vec_ext.h
delete mode 100644 libcxx/include/__cxx03/experimental/iterator
delete mode 100644 libcxx/include/__cxx03/experimental/memory
delete mode 100644 libcxx/include/__cxx03/experimental/propagate_const
delete mode 100644 libcxx/include/__cxx03/experimental/simd
delete mode 100644 libcxx/include/__cxx03/experimental/type_traits
delete mode 100644 libcxx/include/__cxx03/filesystem
delete mode 100644 libcxx/include/__cxx03/format
delete mode 100644 libcxx/include/__cxx03/initializer_list
delete mode 100644 libcxx/include/__cxx03/latch
delete mode 100644 libcxx/include/__cxx03/mdspan
delete mode 100644 libcxx/include/__cxx03/memory_resource
delete mode 100644 libcxx/include/__cxx03/numbers
delete mode 100644 libcxx/include/__cxx03/optional
delete mode 100644 libcxx/include/__cxx03/print
delete mode 100644 libcxx/include/__cxx03/ranges
delete mode 100644 libcxx/include/__cxx03/scoped_allocator
delete mode 100644 libcxx/include/__cxx03/semaphore
delete mode 100644 libcxx/include/__cxx03/shared_mutex
delete mode 100644 libcxx/include/__cxx03/source_location
delete mode 100644 libcxx/include/__cxx03/span
delete mode 100644 libcxx/include/__cxx03/stop_token
delete mode 100644 libcxx/include/__cxx03/syncstream
delete mode 100644 libcxx/include/__cxx03/tuple
delete mode 100644 libcxx/include/__cxx03/variant
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index a021b9bb44d67..00aa2f73f0fba 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1078,7 +1078,6 @@ set(files
__cxx03/__algorithm/all_of.h
__cxx03/__algorithm/any_of.h
__cxx03/__algorithm/binary_search.h
- __cxx03/__algorithm/clamp.h
__cxx03/__algorithm/comp.h
__cxx03/__algorithm/comp_ref_type.h
__cxx03/__algorithm/copy.h
@@ -1098,19 +1097,11 @@ set(files
__cxx03/__algorithm/find_if.h
__cxx03/__algorithm/find_if_not.h
__cxx03/__algorithm/find_segment_if.h
- __cxx03/__algorithm/fold.h
__cxx03/__algorithm/for_each.h
- __cxx03/__algorithm/for_each_n.h
__cxx03/__algorithm/for_each_segment.h
__cxx03/__algorithm/generate.h
__cxx03/__algorithm/generate_n.h
__cxx03/__algorithm/half_positive.h
- __cxx03/__algorithm/in_found_result.h
- __cxx03/__algorithm/in_fun_result.h
- __cxx03/__algorithm/in_in_out_result.h
- __cxx03/__algorithm/in_in_result.h
- __cxx03/__algorithm/in_out_out_result.h
- __cxx03/__algorithm/in_out_result.h
__cxx03/__algorithm/includes.h
__cxx03/__algorithm/inplace_merge.h
__cxx03/__algorithm/is_heap.h
@@ -1122,7 +1113,6 @@ set(files
__cxx03/__algorithm/iter_swap.h
__cxx03/__algorithm/iterator_operations.h
__cxx03/__algorithm/lexicographical_compare.h
- __cxx03/__algorithm/lexicographical_compare_three_way.h
__cxx03/__algorithm/lower_bound.h
__cxx03/__algorithm/make_heap.h
__cxx03/__algorithm/make_projected.h
@@ -1131,7 +1121,6 @@ set(files
__cxx03/__algorithm/merge.h
__cxx03/__algorithm/min.h
__cxx03/__algorithm/min_element.h
- __cxx03/__algorithm/min_max_result.h
__cxx03/__algorithm/minmax.h
__cxx03/__algorithm/minmax_element.h
__cxx03/__algorithm/mismatch.h
@@ -1147,99 +1136,7 @@ set(files
__cxx03/__algorithm/partition_point.h
__cxx03/__algorithm/pop_heap.h
__cxx03/__algorithm/prev_permutation.h
- __cxx03/__algorithm/pstl.h
__cxx03/__algorithm/push_heap.h
- __cxx03/__algorithm/ranges_adjacent_find.h
- __cxx03/__algorithm/ranges_all_of.h
- __cxx03/__algorithm/ranges_any_of.h
- __cxx03/__algorithm/ranges_binary_search.h
- __cxx03/__algorithm/ranges_clamp.h
- __cxx03/__algorithm/ranges_contains.h
- __cxx03/__algorithm/ranges_contains_subrange.h
- __cxx03/__algorithm/ranges_copy.h
- __cxx03/__algorithm/ranges_copy_backward.h
- __cxx03/__algorithm/ranges_copy_if.h
- __cxx03/__algorithm/ranges_copy_n.h
- __cxx03/__algorithm/ranges_count.h
- __cxx03/__algorithm/ranges_count_if.h
- __cxx03/__algorithm/ranges_ends_with.h
- __cxx03/__algorithm/ranges_equal.h
- __cxx03/__algorithm/ranges_equal_range.h
- __cxx03/__algorithm/ranges_fill.h
- __cxx03/__algorithm/ranges_fill_n.h
- __cxx03/__algorithm/ranges_find.h
- __cxx03/__algorithm/ranges_find_end.h
- __cxx03/__algorithm/ranges_find_first_of.h
- __cxx03/__algorithm/ranges_find_if.h
- __cxx03/__algorithm/ranges_find_if_not.h
- __cxx03/__algorithm/ranges_find_last.h
- __cxx03/__algorithm/ranges_for_each.h
- __cxx03/__algorithm/ranges_for_each_n.h
- __cxx03/__algorithm/ranges_generate.h
- __cxx03/__algorithm/ranges_generate_n.h
- __cxx03/__algorithm/ranges_includes.h
- __cxx03/__algorithm/ranges_inplace_merge.h
- __cxx03/__algorithm/ranges_is_heap.h
- __cxx03/__algorithm/ranges_is_heap_until.h
- __cxx03/__algorithm/ranges_is_partitioned.h
- __cxx03/__algorithm/ranges_is_permutation.h
- __cxx03/__algorithm/ranges_is_sorted.h
- __cxx03/__algorithm/ranges_is_sorted_until.h
- __cxx03/__algorithm/ranges_iterator_concept.h
- __cxx03/__algorithm/ranges_lexicographical_compare.h
- __cxx03/__algorithm/ranges_lower_bound.h
- __cxx03/__algorithm/ranges_make_heap.h
- __cxx03/__algorithm/ranges_max.h
- __cxx03/__algorithm/ranges_max_element.h
- __cxx03/__algorithm/ranges_merge.h
- __cxx03/__algorithm/ranges_min.h
- __cxx03/__algorithm/ranges_min_element.h
- __cxx03/__algorithm/ranges_minmax.h
- __cxx03/__algorithm/ranges_minmax_element.h
- __cxx03/__algorithm/ranges_mismatch.h
- __cxx03/__algorithm/ranges_move.h
- __cxx03/__algorithm/ranges_move_backward.h
- __cxx03/__algorithm/ranges_next_permutation.h
- __cxx03/__algorithm/ranges_none_of.h
- __cxx03/__algorithm/ranges_nth_element.h
- __cxx03/__algorithm/ranges_partial_sort.h
- __cxx03/__algorithm/ranges_partial_sort_copy.h
- __cxx03/__algorithm/ranges_partition.h
- __cxx03/__algorithm/ranges_partition_copy.h
- __cxx03/__algorithm/ranges_partition_point.h
- __cxx03/__algorithm/ranges_pop_heap.h
- __cxx03/__algorithm/ranges_prev_permutation.h
- __cxx03/__algorithm/ranges_push_heap.h
- __cxx03/__algorithm/ranges_remove.h
- __cxx03/__algorithm/ranges_remove_copy.h
- __cxx03/__algorithm/ranges_remove_copy_if.h
- __cxx03/__algorithm/ranges_remove_if.h
- __cxx03/__algorithm/ranges_replace.h
- __cxx03/__algorithm/ranges_replace_copy.h
- __cxx03/__algorithm/ranges_replace_copy_if.h
- __cxx03/__algorithm/ranges_replace_if.h
- __cxx03/__algorithm/ranges_reverse.h
- __cxx03/__algorithm/ranges_reverse_copy.h
- __cxx03/__algorithm/ranges_rotate.h
- __cxx03/__algorithm/ranges_rotate_copy.h
- __cxx03/__algorithm/ranges_sample.h
- __cxx03/__algorithm/ranges_search.h
- __cxx03/__algorithm/ranges_search_n.h
- __cxx03/__algorithm/ranges_set_difference.h
- __cxx03/__algorithm/ranges_set_intersection.h
- __cxx03/__algorithm/ranges_set_symmetric_difference.h
- __cxx03/__algorithm/ranges_set_union.h
- __cxx03/__algorithm/ranges_shuffle.h
- __cxx03/__algorithm/ranges_sort.h
- __cxx03/__algorithm/ranges_sort_heap.h
- __cxx03/__algorithm/ranges_stable_partition.h
- __cxx03/__algorithm/ranges_stable_sort.h
- __cxx03/__algorithm/ranges_starts_with.h
- __cxx03/__algorithm/ranges_swap_ranges.h
- __cxx03/__algorithm/ranges_transform.h
- __cxx03/__algorithm/ranges_unique.h
- __cxx03/__algorithm/ranges_unique_copy.h
- __cxx03/__algorithm/ranges_upper_bound.h
__cxx03/__algorithm/remove.h
__cxx03/__algorithm/remove_copy.h
__cxx03/__algorithm/remove_copy_if.h
@@ -1252,15 +1149,12 @@ set(files
__cxx03/__algorithm/reverse_copy.h
__cxx03/__algorithm/rotate.h
__cxx03/__algorithm/rotate_copy.h
- __cxx03/__algorithm/sample.h
__cxx03/__algorithm/search.h
__cxx03/__algorithm/search_n.h
__cxx03/__algorithm/set_difference.h
__cxx03/__algorithm/set_intersection.h
__cxx03/__algorithm/set_symmetric_difference.h
__cxx03/__algorithm/set_union.h
- __cxx03/__algorithm/shift_left.h
- __cxx03/__algorithm/shift_right.h
__cxx03/__algorithm/shuffle.h
__cxx03/__algorithm/sift_down.h
__cxx03/__algorithm/simd_utils.h
@@ -1284,7 +1178,6 @@ set(files
__cxx03/__atomic/atomic_flag.h
__cxx03/__atomic/atomic_init.h
__cxx03/__atomic/atomic_lock_free.h
- __cxx03/__atomic/atomic_ref.h
__cxx03/__atomic/atomic_sync.h
__cxx03/__atomic/check_memory_order.h
__cxx03/__atomic/contention_t.h
@@ -1294,100 +1187,19 @@ set(files
__cxx03/__atomic/kill_dependency.h
__cxx03/__atomic/memory_order.h
__cxx03/__atomic/to_gcc_order.h
- __cxx03/__bit/bit_cast.h
- __cxx03/__bit/bit_ceil.h
- __cxx03/__bit/bit_floor.h
- __cxx03/__bit/bit_log2.h
- __cxx03/__bit/bit_width.h
__cxx03/__bit/blsr.h
- __cxx03/__bit/byteswap.h
__cxx03/__bit/countl.h
__cxx03/__bit/countr.h
- __cxx03/__bit/endian.h
- __cxx03/__bit/has_single_bit.h
__cxx03/__bit/invert_if.h
__cxx03/__bit/popcount.h
__cxx03/__bit/rotate.h
__cxx03/__bit_reference
- __cxx03/__charconv/chars_format.h
- __cxx03/__charconv/from_chars_integral.h
- __cxx03/__charconv/from_chars_result.h
- __cxx03/__charconv/tables.h
- __cxx03/__charconv/to_chars.h
- __cxx03/__charconv/to_chars_base_10.h
- __cxx03/__charconv/to_chars_floating_point.h
- __cxx03/__charconv/to_chars_integral.h
- __cxx03/__charconv/to_chars_result.h
- __cxx03/__charconv/traits.h
- __cxx03/__chrono/calendar.h
- __cxx03/__chrono/concepts.h
__cxx03/__chrono/convert_to_timespec.h
- __cxx03/__chrono/convert_to_tm.h
- __cxx03/__chrono/day.h
__cxx03/__chrono/duration.h
- __cxx03/__chrono/exception.h
- __cxx03/__chrono/file_clock.h
- __cxx03/__chrono/formatter.h
- __cxx03/__chrono/hh_mm_ss.h
__cxx03/__chrono/high_resolution_clock.h
- __cxx03/__chrono/leap_second.h
- __cxx03/__chrono/literals.h
- __cxx03/__chrono/local_info.h
- __cxx03/__chrono/month.h
- __cxx03/__chrono/month_weekday.h
- __cxx03/__chrono/monthday.h
- __cxx03/__chrono/ostream.h
- __cxx03/__chrono/parser_std_format_spec.h
- __cxx03/__chrono/statically_widen.h
__cxx03/__chrono/steady_clock.h
- __cxx03/__chrono/sys_info.h
__cxx03/__chrono/system_clock.h
__cxx03/__chrono/time_point.h
- __cxx03/__chrono/time_zone.h
- __cxx03/__chrono/time_zone_link.h
- __cxx03/__chrono/tzdb.h
- __cxx03/__chrono/tzdb_list.h
- __cxx03/__chrono/weekday.h
- __cxx03/__chrono/year.h
- __cxx03/__chrono/year_month.h
- __cxx03/__chrono/year_month_day.h
- __cxx03/__chrono/year_month_weekday.h
- __cxx03/__chrono/zoned_time.h
- __cxx03/__compare/common_comparison_category.h
- __cxx03/__compare/compare_partial_order_fallback.h
- __cxx03/__compare/compare_strong_order_fallback.h
- __cxx03/__compare/compare_three_way.h
- __cxx03/__compare/compare_three_way_result.h
- __cxx03/__compare/compare_weak_order_fallback.h
- __cxx03/__compare/is_eq.h
- __cxx03/__compare/ordering.h
- __cxx03/__compare/partial_order.h
- __cxx03/__compare/strong_order.h
- __cxx03/__compare/synth_three_way.h
- __cxx03/__compare/three_way_comparable.h
- __cxx03/__compare/weak_order.h
- __cxx03/__concepts/arithmetic.h
- __cxx03/__concepts/assignable.h
- __cxx03/__concepts/boolean_testable.h
- __cxx03/__concepts/class_or_enum.h
- __cxx03/__concepts/common_reference_with.h
- __cxx03/__concepts/common_with.h
- __cxx03/__concepts/constructible.h
- __cxx03/__concepts/convertible_to.h
- __cxx03/__concepts/copyable.h
- __cxx03/__concepts/derived_from.h
- __cxx03/__concepts/destructible.h
- __cxx03/__concepts/different_from.h
- __cxx03/__concepts/equality_comparable.h
- __cxx03/__concepts/invocable.h
- __cxx03/__concepts/movable.h
- __cxx03/__concepts/predicate.h
- __cxx03/__concepts/regular.h
- __cxx03/__concepts/relation.h
- __cxx03/__concepts/same_as.h
- __cxx03/__concepts/semiregular.h
- __cxx03/__concepts/swappable.h
- __cxx03/__concepts/totally_ordered.h
__cxx03/__condition_variable/condition_variable.h
__cxx03/__config
__cxx03/__configuration/abi.h
@@ -1396,10 +1208,6 @@ set(files
__cxx03/__configuration/config_site_shim.h
__cxx03/__configuration/language.h
__cxx03/__configuration/platform.h
- __cxx03/__coroutine/coroutine_handle.h
- __cxx03/__coroutine/coroutine_traits.h
- __cxx03/__coroutine/noop_coroutine_handle.h
- __cxx03/__coroutine/trivial_awaitables.h
__cxx03/__debug_utils/randomize_range.h
__cxx03/__debug_utils/sanitizers.h
__cxx03/__debug_utils/strict_weak_ordering_check.h
@@ -1408,81 +1216,18 @@ set(files
__cxx03/__exception/nested_exception.h
__cxx03/__exception/operations.h
__cxx03/__exception/terminate.h
- __cxx03/__expected/bad_expected_access.h
- __cxx03/__expected/expected.h
- __cxx03/__expected/unexpect.h
- __cxx03/__expected/unexpected.h
- __cxx03/__filesystem/copy_options.h
- __cxx03/__filesystem/directory_entry.h
- __cxx03/__filesystem/directory_iterator.h
- __cxx03/__filesystem/directory_options.h
- __cxx03/__filesystem/file_status.h
- __cxx03/__filesystem/file_time_type.h
- __cxx03/__filesystem/file_type.h
- __cxx03/__filesystem/filesystem_error.h
- __cxx03/__filesystem/operations.h
- __cxx03/__filesystem/path.h
- __cxx03/__filesystem/path_iterator.h
- __cxx03/__filesystem/perm_options.h
- __cxx03/__filesystem/perms.h
- __cxx03/__filesystem/recursive_directory_iterator.h
- __cxx03/__filesystem/space_info.h
- __cxx03/__filesystem/u8path.h
- __cxx03/__format/buffer.h
- __cxx03/__format/concepts.h
- __cxx03/__format/container_adaptor.h
- __cxx03/__format/enable_insertable.h
- __cxx03/__format/escaped_output_table.h
- __cxx03/__format/extended_grapheme_cluster_table.h
- __cxx03/__format/format_arg.h
- __cxx03/__format/format_arg_store.h
- __cxx03/__format/format_args.h
- __cxx03/__format/format_context.h
- __cxx03/__format/format_error.h
- __cxx03/__format/format_functions.h
- __cxx03/__format/format_parse_context.h
- __cxx03/__format/format_string.h
- __cxx03/__format/format_to_n_result.h
- __cxx03/__format/formatter.h
- __cxx03/__format/formatter_bool.h
- __cxx03/__format/formatter_char.h
- __cxx03/__format/formatter_floating_point.h
- __cxx03/__format/formatter_integer.h
- __cxx03/__format/formatter_integral.h
- __cxx03/__format/formatter_output.h
- __cxx03/__format/formatter_pointer.h
- __cxx03/__format/formatter_string.h
- __cxx03/__format/formatter_tuple.h
- __cxx03/__format/indic_conjunct_break_table.h
- __cxx03/__format/parser_std_format_spec.h
- __cxx03/__format/range_default_formatter.h
- __cxx03/__format/range_formatter.h
- __cxx03/__format/unicode.h
- __cxx03/__format/width_estimation_table.h
- __cxx03/__format/write_escaped.h
__cxx03/__functional/binary_function.h
__cxx03/__functional/binary_negate.h
__cxx03/__functional/bind.h
- __cxx03/__functional/bind_back.h
- __cxx03/__functional/bind_front.h
__cxx03/__functional/binder1st.h
__cxx03/__functional/binder2nd.h
- __cxx03/__functional/boyer_moore_searcher.h
- __cxx03/__functional/compose.h
- __cxx03/__functional/default_searcher.h
- __cxx03/__functional/function.h
__cxx03/__functional/hash.h
__cxx03/__functional/identity.h
- __cxx03/__functional/invoke.h
- __cxx03/__functional/is_transparent.h
__cxx03/__functional/mem_fn.h
__cxx03/__functional/mem_fun_ref.h
- __cxx03/__functional/not_fn.h
__cxx03/__functional/operations.h
- __cxx03/__functional/perfect_forward.h
__cxx03/__functional/pointer_to_binary_function.h
__cxx03/__functional/pointer_to_unary_function.h
- __cxx03/__functional/ranges_operations.h
__cxx03/__functional/reference_wrapper.h
__cxx03/__functional/unary_function.h
__cxx03/__functional/unary_negate.h
@@ -1491,24 +1236,19 @@ set(files
__cxx03/__fwd/bit_reference.h
__cxx03/__fwd/complex.h
__cxx03/__fwd/deque.h
- __cxx03/__fwd/format.h
__cxx03/__fwd/fstream.h
__cxx03/__fwd/functional.h
__cxx03/__fwd/ios.h
__cxx03/__fwd/istream.h
- __cxx03/__fwd/mdspan.h
__cxx03/__fwd/memory.h
- __cxx03/__fwd/memory_resource.h
__cxx03/__fwd/ostream.h
__cxx03/__fwd/pair.h
__cxx03/__fwd/queue.h
- __cxx03/__fwd/span.h
__cxx03/__fwd/sstream.h
__cxx03/__fwd/stack.h
__cxx03/__fwd/streambuf.h
__cxx03/__fwd/string.h
__cxx03/__fwd/string_view.h
- __cxx03/__fwd/subrange.h
__cxx03/__fwd/tuple.h
__cxx03/__fwd/vector.h
__cxx03/__hash_table
@@ -1518,43 +1258,21 @@ set(files
__cxx03/__iterator/aliasing_iterator.h
__cxx03/__iterator/back_insert_iterator.h
__cxx03/__iterator/bounded_iter.h
- __cxx03/__iterator/common_iterator.h
- __cxx03/__iterator/concepts.h
- __cxx03/__iterator/counted_iterator.h
- __cxx03/__iterator/cpp17_iterator_concepts.h
- __cxx03/__iterator/data.h
- __cxx03/__iterator/default_sentinel.h
__cxx03/__iterator/distance.h
- __cxx03/__iterator/empty.h
__cxx03/__iterator/erase_if_container.h
__cxx03/__iterator/front_insert_iterator.h
- __cxx03/__iterator/incrementable_traits.h
- __cxx03/__iterator/indirectly_comparable.h
__cxx03/__iterator/insert_iterator.h
__cxx03/__iterator/istream_iterator.h
__cxx03/__iterator/istreambuf_iterator.h
- __cxx03/__iterator/iter_move.h
- __cxx03/__iterator/iter_swap.h
__cxx03/__iterator/iterator.h
__cxx03/__iterator/iterator_traits.h
- __cxx03/__iterator/iterator_with_data.h
- __cxx03/__iterator/mergeable.h
__cxx03/__iterator/move_iterator.h
- __cxx03/__iterator/move_sentinel.h
__cxx03/__iterator/next.h
__cxx03/__iterator/ostream_iterator.h
__cxx03/__iterator/ostreambuf_iterator.h
- __cxx03/__iterator/permutable.h
__cxx03/__iterator/prev.h
- __cxx03/__iterator/projected.h
- __cxx03/__iterator/ranges_iterator_traits.h
- __cxx03/__iterator/readable_traits.h
- __cxx03/__iterator/reverse_access.h
__cxx03/__iterator/reverse_iterator.h
__cxx03/__iterator/segmented_iterator.h
- __cxx03/__iterator/size.h
- __cxx03/__iterator/sortable.h
- __cxx03/__iterator/unreachable_sentinel.h
__cxx03/__iterator/wrap_iter.h
__cxx03/__locale
__cxx03/__locale_dir/locale_base_api.h
@@ -1585,16 +1303,9 @@ set(files
__cxx03/__math/remainder.h
__cxx03/__math/roots.h
__cxx03/__math/rounding_functions.h
- __cxx03/__math/special_functions.h
__cxx03/__math/traits.h
__cxx03/__math/trigonometric_functions.h
__cxx03/__mbstate_t.h
- __cxx03/__mdspan/default_accessor.h
- __cxx03/__mdspan/extents.h
- __cxx03/__mdspan/layout_left.h
- __cxx03/__mdspan/layout_right.h
- __cxx03/__mdspan/layout_stride.h
- __cxx03/__mdspan/mdspan.h
__cxx03/__memory/addressof.h
__cxx03/__memory/align.h
__cxx03/__memory/aligned_alloc.h
@@ -1608,14 +1319,9 @@ set(files
__cxx03/__memory/auto_ptr.h
__cxx03/__memory/builtin_new_allocator.h
__cxx03/__memory/compressed_pair.h
- __cxx03/__memory/concepts.h
__cxx03/__memory/construct_at.h
__cxx03/__memory/destruct_n.h
- __cxx03/__memory/inout_ptr.h
- __cxx03/__memory/out_ptr.h
__cxx03/__memory/pointer_traits.h
- __cxx03/__memory/ranges_construct_at.h
- __cxx03/__memory/ranges_uninitialized_algorithms.h
__cxx03/__memory/raw_storage_iterator.h
__cxx03/__memory/shared_ptr.h
__cxx03/__memory/swap_allocator.h
@@ -1624,54 +1330,18 @@ set(files
__cxx03/__memory/uninitialized_algorithms.h
__cxx03/__memory/unique_ptr.h
__cxx03/__memory/uses_allocator.h
- __cxx03/__memory/uses_allocator_construction.h
__cxx03/__memory/voidify.h
- __cxx03/__memory_resource/memory_resource.h
- __cxx03/__memory_resource/monotonic_buffer_resource.h
- __cxx03/__memory_resource/polymorphic_allocator.h
- __cxx03/__memory_resource/pool_options.h
- __cxx03/__memory_resource/synchronized_pool_resource.h
- __cxx03/__memory_resource/unsynchronized_pool_resource.h
__cxx03/__mutex/lock_guard.h
__cxx03/__mutex/mutex.h
__cxx03/__mutex/once_flag.h
__cxx03/__mutex/tag_types.h
__cxx03/__mutex/unique_lock.h
- __cxx03/__node_handle
__cxx03/__numeric/accumulate.h
__cxx03/__numeric/adjacent_difference.h
- __cxx03/__numeric/exclusive_scan.h
- __cxx03/__numeric/gcd_lcm.h
- __cxx03/__numeric/inclusive_scan.h
__cxx03/__numeric/inner_product.h
__cxx03/__numeric/iota.h
- __cxx03/__numeric/midpoint.h
__cxx03/__numeric/partial_sum.h
- __cxx03/__numeric/pstl.h
- __cxx03/__numeric/reduce.h
- __cxx03/__numeric/saturation_arithmetic.h
- __cxx03/__numeric/transform_exclusive_scan.h
- __cxx03/__numeric/transform_inclusive_scan.h
- __cxx03/__numeric/transform_reduce.h
__cxx03/__ostream/basic_ostream.h
- __cxx03/__ostream/print.h
- __cxx03/__pstl/backend.h
- __cxx03/__pstl/backend_fwd.h
- __cxx03/__pstl/backends/default.h
- __cxx03/__pstl/backends/libdispatch.h
- __cxx03/__pstl/backends/serial.h
- __cxx03/__pstl/backends/std_thread.h
- __cxx03/__pstl/cpu_algos/any_of.h
- __cxx03/__pstl/cpu_algos/cpu_traits.h
- __cxx03/__pstl/cpu_algos/fill.h
- __cxx03/__pstl/cpu_algos/find_if.h
- __cxx03/__pstl/cpu_algos/for_each.h
- __cxx03/__pstl/cpu_algos/merge.h
- __cxx03/__pstl/cpu_algos/stable_sort.h
- __cxx03/__pstl/cpu_algos/transform.h
- __cxx03/__pstl/cpu_algos/transform_reduce.h
- __cxx03/__pstl/dispatch.h
- __cxx03/__pstl/handle_exception.h
__cxx03/__random/bernoulli_distribution.h
__cxx03/__random/binomial_distribution.h
__cxx03/__random/cauchy_distribution.h
@@ -1706,62 +1376,11 @@ set(files
__cxx03/__random/student_t_distribution.h
__cxx03/__random/subtract_with_carry_engine.h
__cxx03/__random/uniform_int_distribution.h
- __cxx03/__random/uniform_random_bit_generator.h
__cxx03/__random/uniform_real_distribution.h
__cxx03/__random/weibull_distribution.h
- __cxx03/__ranges/access.h
- __cxx03/__ranges/all.h
- __cxx03/__ranges/as_rvalue_view.h
- __cxx03/__ranges/chunk_by_view.h
- __cxx03/__ranges/common_view.h
- __cxx03/__ranges/concepts.h
- __cxx03/__ranges/container_compatible_range.h
- __cxx03/__ranges/counted.h
- __cxx03/__ranges/dangling.h
- __cxx03/__ranges/data.h
- __cxx03/__ranges/drop_view.h
- __cxx03/__ranges/drop_while_view.h
- __cxx03/__ranges/elements_view.h
- __cxx03/__ranges/empty.h
- __cxx03/__ranges/empty_view.h
- __cxx03/__ranges/enable_borrowed_range.h
- __cxx03/__ranges/enable_view.h
- __cxx03/__ranges/filter_view.h
- __cxx03/__ranges/from_range.h
- __cxx03/__ranges/iota_view.h
- __cxx03/__ranges/istream_view.h
- __cxx03/__ranges/join_view.h
- __cxx03/__ranges/lazy_split_view.h
- __cxx03/__ranges/movable_box.h
- __cxx03/__ranges/non_propagating_cache.h
- __cxx03/__ranges/owning_view.h
- __cxx03/__ranges/range_adaptor.h
- __cxx03/__ranges/rbegin.h
- __cxx03/__ranges/ref_view.h
- __cxx03/__ranges/rend.h
- __cxx03/__ranges/repeat_view.h
- __cxx03/__ranges/reverse_view.h
- __cxx03/__ranges/single_view.h
- __cxx03/__ranges/size.h
- __cxx03/__ranges/split_view.h
- __cxx03/__ranges/subrange.h
- __cxx03/__ranges/take_view.h
- __cxx03/__ranges/take_while_view.h
- __cxx03/__ranges/to.h
- __cxx03/__ranges/transform_view.h
- __cxx03/__ranges/view_interface.h
- __cxx03/__ranges/views.h
- __cxx03/__ranges/zip_view.h
__cxx03/__split_buffer
__cxx03/__std_clang_module
__cxx03/__std_mbstate_t.h
- __cxx03/__stop_token/atomic_unique_lock.h
- __cxx03/__stop_token/intrusive_list_view.h
- __cxx03/__stop_token/intrusive_shared_ptr.h
- __cxx03/__stop_token/stop_callback.h
- __cxx03/__stop_token/stop_source.h
- __cxx03/__stop_token/stop_state.h
- __cxx03/__stop_token/stop_token.h
__cxx03/__string/char_traits.h
__cxx03/__string/constexpr_c_functions.h
__cxx03/__string/extern_template_lists.h
@@ -1776,9 +1395,7 @@ set(files
__cxx03/__system_error/error_code.h
__cxx03/__system_error/error_condition.h
__cxx03/__system_error/system_error.h
- __cxx03/__thread/formatter.h
__cxx03/__thread/id.h
- __cxx03/__thread/jthread.h
__cxx03/__thread/poll_with_backoff.h
__cxx03/__thread/support.h
__cxx03/__thread/support/c11.h
@@ -1790,7 +1407,6 @@ set(files
__cxx03/__thread/timed_backoff_policy.h
__cxx03/__tree
__cxx03/__tuple/find_index.h
- __cxx03/__tuple/ignore.h
__cxx03/__tuple/make_tuple_types.h
__cxx03/__tuple/sfinae_helpers.h
__cxx03/__tuple/tuple_element.h
@@ -1810,7 +1426,6 @@ set(files
__cxx03/__type_traits/aligned_union.h
__cxx03/__type_traits/alignment_of.h
__cxx03/__type_traits/can_extract_key.h
- __cxx03/__type_traits/common_reference.h
__cxx03/__type_traits/common_type.h
__cxx03/__type_traits/conditional.h
__cxx03/__type_traits/conjunction.h
@@ -1823,12 +1438,10 @@ set(files
__cxx03/__type_traits/disjunction.h
__cxx03/__type_traits/enable_if.h
__cxx03/__type_traits/extent.h
- __cxx03/__type_traits/has_unique_object_representation.h
__cxx03/__type_traits/has_virtual_destructor.h
__cxx03/__type_traits/integral_constant.h
__cxx03/__type_traits/invoke.h
__cxx03/__type_traits/is_abstract.h
- __cxx03/__type_traits/is_aggregate.h
__cxx03/__type_traits/is_allocator.h
__cxx03/__type_traits/is_always_bitcastable.h
__cxx03/__type_traits/is_arithmetic.h
@@ -1860,7 +1473,6 @@ set(files
__cxx03/__type_traits/is_member_pointer.h
__cxx03/__type_traits/is_nothrow_assignable.h
__cxx03/__type_traits/is_nothrow_constructible.h
- __cxx03/__type_traits/is_nothrow_convertible.h
__cxx03/__type_traits/is_nothrow_destructible.h
__cxx03/__type_traits/is_null_pointer.h
__cxx03/__type_traits/is_object.h
@@ -1920,18 +1532,13 @@ set(files
__cxx03/__type_traits/unwrap_ref.h
__cxx03/__type_traits/void_t.h
__cxx03/__undef_macros
- __cxx03/__utility/as_const.h
__cxx03/__utility/as_lvalue.h
__cxx03/__utility/auto_cast.h
- __cxx03/__utility/cmp.h
__cxx03/__utility/convert_to_integral.h
__cxx03/__utility/declval.h
__cxx03/__utility/empty.h
__cxx03/__utility/exception_guard.h
- __cxx03/__utility/exchange.h
__cxx03/__utility/forward.h
- __cxx03/__utility/forward_like.h
- __cxx03/__utility/in_place.h
__cxx03/__utility/integer_sequence.h
__cxx03/__utility/is_pointer_in_range.h
__cxx03/__utility/is_valid_range.h
@@ -1944,16 +1551,12 @@ set(files
__cxx03/__utility/rel_ops.h
__cxx03/__utility/small_buffer.h
__cxx03/__utility/swap.h
- __cxx03/__utility/to_underlying.h
__cxx03/__utility/unreachable.h
__cxx03/__variant/monostate.h
__cxx03/__verbose_abort
__cxx03/algorithm
- __cxx03/any
__cxx03/array
__cxx03/atomic
- __cxx03/barrier
- __cxx03/bit
__cxx03/bitset
__cxx03/cassert
__cxx03/ccomplex
@@ -1961,7 +1564,6 @@ set(files
__cxx03/cerrno
__cxx03/cfenv
__cxx03/cfloat
- __cxx03/charconv
__cxx03/chrono
__cxx03/cinttypes
__cxx03/ciso646
@@ -1969,12 +1571,9 @@ set(files
__cxx03/clocale
__cxx03/cmath
__cxx03/codecvt
- __cxx03/compare
__cxx03/complex
__cxx03/complex.h
- __cxx03/concepts
__cxx03/condition_variable
- __cxx03/coroutine
__cxx03/csetjmp
__cxx03/csignal
__cxx03/cstdarg
@@ -1993,36 +1592,15 @@ set(files
__cxx03/deque
__cxx03/errno.h
__cxx03/exception
- __cxx03/execution
- __cxx03/expected
- __cxx03/experimental/__config
- __cxx03/experimental/__simd/aligned_tag.h
- __cxx03/experimental/__simd/declaration.h
- __cxx03/experimental/__simd/reference.h
- __cxx03/experimental/__simd/scalar.h
- __cxx03/experimental/__simd/simd.h
- __cxx03/experimental/__simd/simd_mask.h
- __cxx03/experimental/__simd/traits.h
- __cxx03/experimental/__simd/utility.h
- __cxx03/experimental/__simd/vec_ext.h
- __cxx03/experimental/iterator
- __cxx03/experimental/memory
- __cxx03/experimental/propagate_const
- __cxx03/experimental/simd
- __cxx03/experimental/type_traits
- __cxx03/experimental/utility
__cxx03/ext/__hash
__cxx03/ext/hash_map
__cxx03/ext/hash_set
__cxx03/fenv.h
- __cxx03/filesystem
__cxx03/float.h
- __cxx03/format
__cxx03/forward_list
__cxx03/fstream
__cxx03/functional
__cxx03/future
- __cxx03/initializer_list
__cxx03/inttypes.h
__cxx03/iomanip
__cxx03/ios
@@ -2030,35 +1608,23 @@ set(files
__cxx03/iostream
__cxx03/istream
__cxx03/iterator
- __cxx03/latch
__cxx03/limits
__cxx03/list
__cxx03/locale
__cxx03/locale.h
__cxx03/map
__cxx03/math.h
- __cxx03/mdspan
__cxx03/memory
- __cxx03/memory_resource
__cxx03/module.modulemap
__cxx03/mutex
__cxx03/new
- __cxx03/numbers
__cxx03/numeric
- __cxx03/optional
__cxx03/ostream
- __cxx03/print
__cxx03/queue
__cxx03/random
- __cxx03/ranges
__cxx03/ratio
__cxx03/regex
- __cxx03/scoped_allocator
- __cxx03/semaphore
__cxx03/set
- __cxx03/shared_mutex
- __cxx03/source_location
- __cxx03/span
__cxx03/sstream
__cxx03/stack
__cxx03/stdatomic.h
@@ -2068,17 +1634,14 @@ set(files
__cxx03/stdint.h
__cxx03/stdio.h
__cxx03/stdlib.h
- __cxx03/stop_token
__cxx03/streambuf
__cxx03/string
__cxx03/string.h
__cxx03/string_view
__cxx03/strstream
- __cxx03/syncstream
__cxx03/system_error
__cxx03/tgmath.h
__cxx03/thread
- __cxx03/tuple
__cxx03/type_traits
__cxx03/typeindex
__cxx03/typeinfo
@@ -2087,7 +1650,6 @@ set(files
__cxx03/unordered_set
__cxx03/utility
__cxx03/valarray
- __cxx03/variant
__cxx03/vector
__cxx03/version
__cxx03/wchar.h
diff --git a/libcxx/include/__cxx03/__algorithm/clamp.h b/libcxx/include/__cxx03/__algorithm/clamp.h
deleted file mode 100644
index 0e4bb0eb6b950..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/clamp.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_CLAMP_H
-#define _LIBCPP___CXX03___ALGORITHM_CLAMP_H
-
-#include <__cxx03/__algorithm/comp.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-template <class _Tp, class _Compare>
-[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
-clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
- _LIBCPP_LIFETIMEBOUND const _Tp& __lo,
- _LIBCPP_LIFETIMEBOUND const _Tp& __hi,
- _Compare __comp) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
- return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
-}
-
-template <class _Tp>
-[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
-clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
- _LIBCPP_LIFETIMEBOUND const _Tp& __lo,
- _LIBCPP_LIFETIMEBOUND const _Tp& __hi) {
- return std::clamp(__v, __lo, __hi, __less<>());
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ALGORITHM_CLAMP_H
diff --git a/libcxx/include/__cxx03/__algorithm/count.h b/libcxx/include/__cxx03/__algorithm/count.h
index 7c1fc3e579898..28cc28f76dd8f 100644
--- a/libcxx/include/__cxx03/__algorithm/count.h
+++ b/libcxx/include/__cxx03/__algorithm/count.h
@@ -16,9 +16,9 @@
#include <__cxx03/__bit/popcount.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__fwd/bit_reference.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__algorithm/equal.h b/libcxx/include/__cxx03/__algorithm/equal.h
index 4e478932981e7..25b2d5ba0a825 100644
--- a/libcxx/include/__cxx03/__algorithm/equal.h
+++ b/libcxx/include/__cxx03/__algorithm/equal.h
@@ -14,13 +14,12 @@
#include <__cxx03/__algorithm/unwrap_iter.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__string/constexpr_c_functions.h>
#include <__cxx03/__type_traits/desugars_to.h>
#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_constant_evaluated.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_equality_comparable.h>
#include <__cxx03/__type_traits/is_volatile.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/equal_range.h b/libcxx/include/__cxx03/__algorithm/equal_range.h
index 4b3126a2840cf..c2d23cdf0df4a 100644
--- a/libcxx/include/__cxx03/__algorithm/equal_range.h
+++ b/libcxx/include/__cxx03/__algorithm/equal_range.h
@@ -17,11 +17,11 @@
#include <__cxx03/__algorithm/upper_bound.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__type_traits/is_constructible.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/find.h b/libcxx/include/__cxx03/__algorithm/find.h
index ff5ac9b8b1bd0..8afa8cb389d16 100644
--- a/libcxx/include/__cxx03/__algorithm/find.h
+++ b/libcxx/include/__cxx03/__algorithm/find.h
@@ -17,7 +17,6 @@
#include <__cxx03/__bit/invert_if.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__fwd/bit_reference.h>
#include <__cxx03/__iterator/segmented_iterator.h>
#include <__cxx03/__string/constexpr_c_functions.h>
diff --git a/libcxx/include/__cxx03/__algorithm/find_end.h b/libcxx/include/__cxx03/__algorithm/find_end.h
index 3fa046bd0df3e..5feececb0adfb 100644
--- a/libcxx/include/__cxx03/__algorithm/find_end.h
+++ b/libcxx/include/__cxx03/__algorithm/find_end.h
@@ -15,11 +15,11 @@
#include <__cxx03/__algorithm/search.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
#include <__cxx03/__iterator/reverse_iterator.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__utility/pair.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__algorithm/fold.h b/libcxx/include/__cxx03/__algorithm/fold.h
deleted file mode 100644
index 5ec0d747c009c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/fold.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_FOLD_H
-#define _LIBCPP___CXX03___ALGORITHM_FOLD_H
-
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/invoke.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace ranges {
-template <class _Ip, class _Tp>
-struct in_value_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _Ip in;
- _LIBCPP_NO_UNIQUE_ADDRESS _Tp value;
-
- template <class _I2, class _T2>
- requires convertible_to<const _Ip&, _I2> && convertible_to<const _Tp&, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() const& {
- return {in, value};
- }
-
- template <class _I2, class _T2>
- requires convertible_to<_Ip, _I2> && convertible_to<_Tp, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() && {
- return {std::move(in), std::move(value)};
- }
-};
-
-template <class _Ip, class _Tp>
-using fold_left_with_iter_result = in_value_result<_Ip, _Tp>;
-
-template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>>
-concept __indirectly_binary_left_foldable_impl =
- convertible_to<_Rp, _Up> && //
- movable<_Tp> && //
- movable<_Up> && //
- convertible_to<_Tp, _Up> && //
- invocable<_Fp&, _Up, iter_reference_t<_Ip>> && //
- assignable_from<_Up&, invoke_result_t<_Fp&, _Up, iter_reference_t<_Ip>>>;
-
-template <class _Fp, class _Tp, class _Ip>
-concept __indirectly_binary_left_foldable =
- copy_constructible<_Fp> && //
- invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && //
- __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
-
-struct __fold_left_with_iter {
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
- using _Up = decay_t<invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
-
- if (__first == __last) {
- return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), _Up(std::move(__init))};
- }
-
- _Up __result = std::invoke(__f, std::move(__init), *__first);
- for (++__first; __first != __last; ++__first) {
- __result = std::invoke(__f, std::move(__result), *__first);
- }
-
- return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)};
- }
-
- template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
- auto __result = operator()(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f));
-
- using _Up = decay_t<invoke_result_t<_Fp&, _Tp, range_reference_t<_Rp>>>;
- return fold_left_with_iter_result<borrowed_iterator_t<_Rp>, _Up>{std::move(__result.in), std::move(__result.value)};
- }
-};
-
-inline constexpr auto fold_left_with_iter = __fold_left_with_iter();
-
-struct __fold_left {
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
- return fold_left_with_iter(std::move(__first), std::move(__last), std::move(__init), std::ref(__f)).value;
- }
-
- template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
- return fold_left_with_iter(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)).value;
- }
-};
-
-inline constexpr auto fold_left = __fold_left();
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_FOLD_H
diff --git a/libcxx/include/__cxx03/__algorithm/for_each.h b/libcxx/include/__cxx03/__algorithm/for_each.h
index a6faf805fe9cf..b1b16d46127cb 100644
--- a/libcxx/include/__cxx03/__algorithm/for_each.h
+++ b/libcxx/include/__cxx03/__algorithm/for_each.h
@@ -13,9 +13,7 @@
#include <__cxx03/__algorithm/for_each_segment.h>
#include <__cxx03/__config>
#include <__cxx03/__iterator/segmented_iterator.h>
-#include <__cxx03/__ranges/movable_box.h>
#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__utility/in_place.h>
#include <__cxx03/__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__algorithm/for_each_n.h b/libcxx/include/__cxx03/__algorithm/for_each_n.h
deleted file mode 100644
index 486a5266ad011..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/for_each_n.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_FOR_EACH_N_H
-#define _LIBCPP___CXX03___ALGORITHM_FOR_EACH_N_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__utility/convert_to_integral.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _InputIterator, class _Size, class _Function>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
-for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) {
- typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
- _IntegralSize __n = __orig_n;
- while (__n > 0) {
- __f(*__first);
- ++__first;
- --__n;
- }
- return __first;
-}
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ALGORITHM_FOR_EACH_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_found_result.h b/libcxx/include/__cxx03/__algorithm/in_found_result.h
deleted file mode 100644
index 234e17cbd019a..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_found_result.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_FOUND_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_FOUND_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-template <class _InIter1>
-struct in_found_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
- bool found;
-
- template <class _InIter2>
- requires convertible_to<const _InIter1&, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() const& {
- return {in, found};
- }
-
- template <class _InIter2>
- requires convertible_to<_InIter1, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_found_result<_InIter2>() && {
- return {std::move(in), found};
- }
-};
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_FOUND_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_fun_result.h b/libcxx/include/__cxx03/__algorithm/in_fun_result.h
deleted file mode 100644
index 402fbecc3df04..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_fun_result.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_FUN_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_FUN_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _InIter1, class _Func1>
-struct in_fun_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
- _LIBCPP_NO_UNIQUE_ADDRESS _Func1 fun;
-
- template <class _InIter2, class _Func2>
- requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _Func1&, _Func2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() const& {
- return {in, fun};
- }
-
- template <class _InIter2, class _Func2>
- requires convertible_to<_InIter1, _InIter2> && convertible_to<_Func1, _Func2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_fun_result<_InIter2, _Func2>() && {
- return {std::move(in), std::move(fun)};
- }
-};
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_FUN_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_in_out_result.h b/libcxx/include/__cxx03/__algorithm/in_in_out_result.h
deleted file mode 100644
index cb14a7e654faa..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_in_out_result.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_IN_OUT_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_IN_OUT_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2, class _OutIter1>
-struct in_in_out_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in1;
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter2 in2;
- _LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
-
- template <class _InIter3, class _InIter4, class _OutIter2>
- requires convertible_to<const _InIter1&, _InIter3> && convertible_to<const _InIter2&, _InIter4> &&
- convertible_to<const _OutIter1&, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() const& {
- return {in1, in2, out};
- }
-
- template <class _InIter3, class _InIter4, class _OutIter2>
- requires convertible_to<_InIter1, _InIter3> && convertible_to<_InIter2, _InIter4> &&
- convertible_to<_OutIter1, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_out_result<_InIter3, _InIter4, _OutIter2>() && {
- return {std::move(in1), std::move(in2), std::move(out)};
- }
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_IN_OUT_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_in_result.h b/libcxx/include/__cxx03/__algorithm/in_in_result.h
deleted file mode 100644
index 3ef349f87ff6c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_in_result.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_IN_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_IN_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2>
-struct in_in_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in1;
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter2 in2;
-
- template <class _InIter3, class _InIter4>
- requires convertible_to<const _InIter1&, _InIter3> && convertible_to<const _InIter2&, _InIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_result<_InIter3, _InIter4>() const& {
- return {in1, in2};
- }
-
- template <class _InIter3, class _InIter4>
- requires convertible_to<_InIter1, _InIter3> && convertible_to<_InIter2, _InIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_in_result<_InIter3, _InIter4>() && {
- return {std::move(in1), std::move(in2)};
- }
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_IN_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_out_out_result.h b/libcxx/include/__cxx03/__algorithm/in_out_out_result.h
deleted file mode 100644
index de67ac89fefeb..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_out_out_result.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_OUT_OUT_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_OUT_OUT_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _InIter1, class _OutIter1, class _OutIter2>
-struct in_out_out_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
- _LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out1;
- _LIBCPP_NO_UNIQUE_ADDRESS _OutIter2 out2;
-
- template <class _InIter2, class _OutIter3, class _OutIter4>
- requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _OutIter1&, _OutIter3> &&
- convertible_to<const _OutIter2&, _OutIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() const& {
- return {in, out1, out2};
- }
-
- template <class _InIter2, class _OutIter3, class _OutIter4>
- requires convertible_to<_InIter1, _InIter2> && convertible_to<_OutIter1, _OutIter3> &&
- convertible_to<_OutIter2, _OutIter4>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_out_result<_InIter2, _OutIter3, _OutIter4>() && {
- return {std::move(in), std::move(out1), std::move(out2)};
- }
-};
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_OUT_OUT_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/in_out_result.h b/libcxx/include/__cxx03/__algorithm/in_out_result.h
deleted file mode 100644
index e80f5fd7ba77b..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/in_out_result.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_IN_OUT_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_IN_OUT_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _InIter1, class _OutIter1>
-struct in_out_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _InIter1 in;
- _LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out;
-
- template <class _InIter2, class _OutIter2>
- requires convertible_to<const _InIter1&, _InIter2> && convertible_to<const _OutIter1&, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_result<_InIter2, _OutIter2>() const& {
- return {in, out};
- }
-
- template <class _InIter2, class _OutIter2>
- requires convertible_to<_InIter1, _InIter2> && convertible_to<_OutIter1, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator in_out_result<_InIter2, _OutIter2>() && {
- return {std::move(in), std::move(out)};
- }
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_IN_OUT_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/includes.h b/libcxx/include/__cxx03/__algorithm/includes.h
index 24b46d1f10cb5..725940b5acb74 100644
--- a/libcxx/include/__cxx03/__algorithm/includes.h
+++ b/libcxx/include/__cxx03/__algorithm/includes.h
@@ -13,8 +13,8 @@
#include <__cxx03/__algorithm/comp_ref_type.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/is_permutation.h b/libcxx/include/__cxx03/__algorithm/is_permutation.h
index fd29e82656a3c..558077f8ab81f 100644
--- a/libcxx/include/__cxx03/__algorithm/is_permutation.h
+++ b/libcxx/include/__cxx03/__algorithm/is_permutation.h
@@ -14,11 +14,10 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/iterator_operations.h b/libcxx/include/__cxx03/__algorithm/iterator_operations.h
index 24973b66e4f96..6ed7d537134ed 100644
--- a/libcxx/include/__cxx03/__algorithm/iterator_operations.h
+++ b/libcxx/include/__cxx03/__algorithm/iterator_operations.h
@@ -10,18 +10,13 @@
#define _LIBCPP___CXX03___ALGORITHM_ITERATOR_OPERATIONS_H
#include <__cxx03/__algorithm/iter_swap.h>
-#include <__cxx03/__algorithm/ranges_iterator_concept.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__iterator/advance.h>
#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
#include <__cxx03/__iterator/prev.h>
-#include <__cxx03/__iterator/readable_traits.h>
#include <__cxx03/__type_traits/enable_if.h>
#include <__cxx03/__type_traits/is_reference.h>
#include <__cxx03/__type_traits/is_same.h>
diff --git a/libcxx/include/__cxx03/__algorithm/lexicographical_compare_three_way.h b/libcxx/include/__cxx03/__algorithm/lexicographical_compare_three_way.h
deleted file mode 100644
index 2fc53636abbd4..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/lexicographical_compare_three_way.h
+++ /dev/null
@@ -1,125 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
-#define _LIBCPP___CXX03___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
-
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__algorithm/three_way_comp_ref_type.h>
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// Fast path for random access iterators which computes the number of loop iterations up-front and
-// then skips the iterator comparisons inside the loop.
-template <class _InputIterator1, class _InputIterator2, class _Cmp>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path(
- _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
- -> decltype(__comp(*__first1, *__first2)) {
- static_assert(
- signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior.");
- static_assert(
- signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior.");
-
- using _Len1 = __iter_diff_t<_InputIterator1>;
- using _Len2 = __iter_diff_t<_InputIterator2>;
- using _Common = common_type_t<_Len1, _Len2>;
-
- _Len1 __len1 = __last1 - __first1;
- _Len2 __len2 = __last2 - __first2;
- _Common __min_len = std::min<_Common>(__len1, __len2);
-
- for (_Common __i = 0; __i < __min_len; ++__i) {
- auto __c = __comp(*__first1, *__first2);
- if (__c != 0) {
- return __c;
- }
- ++__first1;
- ++__first2;
- }
-
- return __len1 <=> __len2;
-}
-
-// Unoptimized implementation which compares the iterators against the end in every loop iteration
-template <class _InputIterator1, class _InputIterator2, class _Cmp>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_slow_path(
- _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp)
- -> decltype(__comp(*__first1, *__first2)) {
- while (true) {
- bool __exhausted1 = __first1 == __last1;
- bool __exhausted2 = __first2 == __last2;
-
- if (__exhausted1 || __exhausted2) {
- if (!__exhausted1)
- return strong_ordering::greater;
- if (!__exhausted2)
- return strong_ordering::less;
- return strong_ordering::equal;
- }
-
- auto __c = __comp(*__first1, *__first2);
- if (__c != 0) {
- return __c;
- }
-
- ++__first1;
- ++__first2;
- }
-}
-
-template <class _InputIterator1, class _InputIterator2, class _Cmp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way(
- _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp __comp)
- -> decltype(__comp(*__first1, *__first2)) {
- static_assert(__comparison_category<decltype(__comp(*__first1, *__first2))>,
- "The comparator passed to lexicographical_compare_three_way must return a comparison category type.");
- static_assert(std::is_copy_constructible_v<_InputIterator1>, "Iterators must be copy constructible.");
- static_assert(std::is_copy_constructible_v<_InputIterator2>, "Iterators must be copy constructible.");
- __three_way_comp_ref_type<_Cmp> __wrapped_comp_ref(__comp);
- if constexpr (__has_random_access_iterator_category<_InputIterator1>::value &&
- __has_random_access_iterator_category<_InputIterator2>::value) {
- return std::__lexicographical_compare_three_way_fast_path(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref);
- } else {
- // Unoptimized implementation which compares the iterators against the end in every loop iteration
- return std::__lexicographical_compare_three_way_slow_path(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref);
- }
-}
-
-template <class _InputIterator1, class _InputIterator2>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way(
- _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
- return std::lexicographical_compare_three_way(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way());
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
diff --git a/libcxx/include/__cxx03/__algorithm/lower_bound.h b/libcxx/include/__cxx03/__algorithm/lower_bound.h
index 810792bfe8fe1..a0d728009b7ff 100644
--- a/libcxx/include/__cxx03/__algorithm/lower_bound.h
+++ b/libcxx/include/__cxx03/__algorithm/lower_bound.h
@@ -14,10 +14,10 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__type_traits/remove_reference.h>
diff --git a/libcxx/include/__cxx03/__algorithm/make_projected.h b/libcxx/include/__cxx03/__algorithm/make_projected.h
index ac17c2bba7ba8..be36426d3b58e 100644
--- a/libcxx/include/__cxx03/__algorithm/make_projected.h
+++ b/libcxx/include/__cxx03/__algorithm/make_projected.h
@@ -9,13 +9,12 @@
#ifndef _LIBCPP___CXX03___ALGORITHM_MAKE_PROJECTED_H
#define _LIBCPP___CXX03___ALGORITHM_MAKE_PROJECTED_H
-#include <__cxx03/__concepts/same_as.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__type_traits/decay.h>
#include <__cxx03/__type_traits/enable_if.h>
#include <__cxx03/__type_traits/integral_constant.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_member_pointer.h>
#include <__cxx03/__type_traits/is_same.h>
#include <__cxx03/__utility/declval.h>
diff --git a/libcxx/include/__cxx03/__algorithm/max.h b/libcxx/include/__cxx03/__algorithm/max.h
index 7726d16827157..7b13e78c2761a 100644
--- a/libcxx/include/__cxx03/__algorithm/max.h
+++ b/libcxx/include/__cxx03/__algorithm/max.h
@@ -13,7 +13,6 @@
#include <__cxx03/__algorithm/comp_ref_type.h>
#include <__cxx03/__algorithm/max_element.h>
#include <__cxx03/__config>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__algorithm/min.h b/libcxx/include/__cxx03/__algorithm/min.h
index d4801ab3330da..751c53a953828 100644
--- a/libcxx/include/__cxx03/__algorithm/min.h
+++ b/libcxx/include/__cxx03/__algorithm/min.h
@@ -13,7 +13,6 @@
#include <__cxx03/__algorithm/comp_ref_type.h>
#include <__cxx03/__algorithm/min_element.h>
#include <__cxx03/__config>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__algorithm/min_element.h b/libcxx/include/__cxx03/__algorithm/min_element.h
index aa4f6013e8752..11c059c3acdc2 100644
--- a/libcxx/include/__cxx03/__algorithm/min_element.h
+++ b/libcxx/include/__cxx03/__algorithm/min_element.h
@@ -13,8 +13,8 @@
#include <__cxx03/__algorithm/comp_ref_type.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/min_max_result.h b/libcxx/include/__cxx03/__algorithm/min_max_result.h
deleted file mode 100644
index 2098aada70a52..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/min_max_result.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ALGORITHM_MIN_MAX_RESULT_H
-#define _LIBCPP___CXX03___ALGORITHM_MIN_MAX_RESULT_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _T1>
-struct min_max_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _T1 min;
- _LIBCPP_NO_UNIQUE_ADDRESS _T1 max;
-
- template <class _T2>
- requires convertible_to<const _T1&, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const& {
- return {min, max};
- }
-
- template <class _T2>
- requires convertible_to<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() && {
- return {std::move(min), std::move(max)};
- }
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_MIN_MAX_RESULT_H
diff --git a/libcxx/include/__cxx03/__algorithm/minmax.h b/libcxx/include/__cxx03/__algorithm/minmax.h
index e09a5b04104aa..6569dafa3aafc 100644
--- a/libcxx/include/__cxx03/__algorithm/minmax.h
+++ b/libcxx/include/__cxx03/__algorithm/minmax.h
@@ -15,7 +15,6 @@
#include <__cxx03/__functional/identity.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/pair.h>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__algorithm/minmax_element.h b/libcxx/include/__cxx03/__algorithm/minmax_element.h
index 673c22020ef3a..c400ec2e8c7d5 100644
--- a/libcxx/include/__cxx03/__algorithm/minmax_element.h
+++ b/libcxx/include/__cxx03/__algorithm/minmax_element.h
@@ -12,8 +12,8 @@
#include <__cxx03/__algorithm/comp.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/pair.h>
diff --git a/libcxx/include/__cxx03/__algorithm/partial_sort_copy.h b/libcxx/include/__cxx03/__algorithm/partial_sort_copy.h
index d4b5fafba9678..41189cfe029df 100644
--- a/libcxx/include/__cxx03/__algorithm/partial_sort_copy.h
+++ b/libcxx/include/__cxx03/__algorithm/partial_sort_copy.h
@@ -18,8 +18,8 @@
#include <__cxx03/__algorithm/sort_heap.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/__utility/pair.h>
diff --git a/libcxx/include/__cxx03/__algorithm/pstl.h b/libcxx/include/__cxx03/__algorithm/pstl.h
deleted file mode 100644
index 4fc0d47996107..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/pstl.h
+++ /dev/null
@@ -1,663 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_PSTL_H
-#define _LIBCPP___CXX03___ALGORITHM_PSTL_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-# include <__cxx03/__functional/operations.h>
-# include <__cxx03/__iterator/cpp17_iterator_concepts.h>
-# include <__cxx03/__iterator/iterator_traits.h>
-# include <__cxx03/__pstl/backend.h>
-# include <__cxx03/__pstl/dispatch.h>
-# include <__cxx03/__pstl/handle_exception.h>
-# include <__cxx03/__type_traits/enable_if.h>
-# include <__cxx03/__type_traits/is_execution_policy.h>
-# include <__cxx03/__type_traits/remove_cvref.h>
-# include <__cxx03/__utility/forward.h>
-# include <__cxx03/__utility/move.h>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
-any_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "any_of requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__any_of, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
-all_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "all_of requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__all_of, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
-none_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "none_of requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__none_of, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
-copy(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __result) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardIterator, "copy(first, last, result) requires [first, last) to be ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardOutIterator, "copy(first, last, result) requires result to be a ForwardIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(*__first), "copy(first, last, result) requires result to be an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__copy, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Size,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
-copy_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _ForwardOutIterator __result) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardIterator, "copy_n(first, n, result) requires first to be a ForwardIterator");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardOutIterator, "copy_n(first, n, result) requires result to be a ForwardIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(*__first), "copy_n(first, n, result) requires result to be an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__copy_n, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__result));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
-count_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardIterator, "count_if(first, last, pred) requires [first, last) to be ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__count_if, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
-count(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
- _ForwardIterator, "count(first, last, val) requires [first, last) to be ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__count, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI bool
-equal(_ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Pred __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__equal_3leg, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI bool
-equal(_ExecutionPolicy&& __policy, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__equal_3leg, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- equal_to{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI bool
-equal(_ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _Pred __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__equal, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI bool
-equal(_ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__equal, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- equal_to{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-fill(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "fill requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__fill, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Size,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-fill_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, const _Tp& __value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "fill_n requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__fill_n, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), __value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-find_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__find_if, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-find_if_not(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if_not requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__find_if_not, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__find, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Function,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-for_each(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Function __func) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "for_each requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__for_each, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__func));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Size,
- class _Function,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-for_each_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __size, _Function __func) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "for_each_n requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__for_each_n, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__size), std::move(__func));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Generator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-generate(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "generate requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__generate, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__gen));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Size,
- class _Generator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-generate_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Generator __gen) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "generate_n requires a ForwardIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__generate_n, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__gen));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool
-is_partitioned(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_partitioned requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__is_partitioned, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _Comp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
-merge(_ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __result,
- _Comp __comp) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "merge requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "merge requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first1), "merge requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first2), "merge requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__merge, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- std::move(__comp));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
-merge(_ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __result) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "merge requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "merge requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first1), "merge requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first2), "merge requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__merge, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- less{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
-move(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __result) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "move requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "move requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(std::move(*__first)), "move requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__move, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-replace_if(_ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Pred __pred,
- const _Tp& __new_value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace_if requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__replace_if, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred), __new_value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-replace(_ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- const _Tp& __old_value,
- const _Tp& __new_value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__replace, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __old_value, __new_value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Pred,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void replace_copy_if(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- _Pred __pred,
- const _Tp& __new_value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace_copy_if requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "replace_copy_if requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(*__first), "replace_copy_if requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, const _Tp&, "replace_copy requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__replace_copy_if, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- std::move(__result),
- std::move(__pred),
- __new_value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void replace_copy(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- const _Tp& __old_value,
- const _Tp& __new_value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace_copy requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "replace_copy requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(*__first), "replace_copy requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, const _Tp&, "replace_copy requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__replace_copy, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- std::move(__result),
- __old_value,
- __new_value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator rotate_copy(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __middle,
- _ForwardIterator __last,
- _ForwardOutIterator __result) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "rotate_copy requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "rotate_copy requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(*__first), "rotate_copy requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__rotate_copy, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__middle),
- std::move(__last),
- std::move(__result));
-}
-
-template <class _ExecutionPolicy,
- class _RandomAccessIterator,
- class _Comp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__sort, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
-}
-
-template <class _ExecutionPolicy,
- class _RandomAccessIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__sort, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
-}
-
-template <class _ExecutionPolicy,
- class _RandomAccessIterator,
- class _Comp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-stable_sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "stable_sort requires RandomAccessIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__stable_sort, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
-}
-
-template <class _ExecutionPolicy,
- class _RandomAccessIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-stable_sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "stable_sort requires RandomAccessIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__stable_sort, __pstl::__current_configuration, _RawPolicy>;
- __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _UnaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- _UnaryOperation __op) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(__op(*__first)), "transform requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__transform, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- std::move(__result),
- std::move(__op));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
- _ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardOutIterator __result,
- _BinaryOperation __op) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(__op(*__first1, *__first2)), "transform requires an OutputIterator");
- using _Implementation = __pstl::__dispatch<__pstl::__transform_binary, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__result),
- std::move(__op));
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_PSTL_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_adjacent_find.h b/libcxx/include/__cxx03/__algorithm/ranges_adjacent_find.h
deleted file mode 100644
index e62db90f83c18..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_adjacent_find.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ADJACENT_FIND_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ADJACENT_FIND_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __adjacent_find {
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __adjacent_find_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- if (__first == __last)
- return __first;
-
- auto __i = __first;
- while (++__i != __last) {
- if (std::invoke(__pred, std::invoke(__proj, *__first), std::invoke(__proj, *__i)))
- return __first;
- __first = __i;
- }
- return __i;
- }
-
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_binary_predicate<projected<_Iter, _Proj>, projected<_Iter, _Proj>> _Pred = ranges::equal_to>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
- return __adjacent_find_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>, projected<iterator_t<_Range>, _Proj>>
- _Pred = ranges::equal_to>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const {
- return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __adjacent_find
-
-inline namespace __cpo {
-inline constexpr auto adjacent_find = __adjacent_find::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ADJACENT_FIND_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_all_of.h b/libcxx/include/__cxx03/__algorithm/ranges_all_of.h
deleted file mode 100644
index e03f48b23c222..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_all_of.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ALL_OF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ALL_OF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __all_of {
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (!std::invoke(__pred, std::invoke(__proj, *__first)))
- return false;
- }
- return true;
- }
-
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return __all_of_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __all_of
-
-inline namespace __cpo {
-inline constexpr auto all_of = __all_of::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ALL_OF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_any_of.h b/libcxx/include/__cxx03/__algorithm/ranges_any_of.h
deleted file mode 100644
index 23b21f9a8bf13..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_any_of.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ANY_OF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ANY_OF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __any_of {
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- return true;
- }
- return false;
- }
-
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
- return __any_of_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __any_of
-
-inline namespace __cpo {
-inline constexpr auto any_of = __any_of::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ANY_OF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_binary_search.h b/libcxx/include/__cxx03/__algorithm/ranges_binary_search.h
deleted file mode 100644
index 18ebf2b07bdb6..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_binary_search.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_BINARY_SEARCH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_BINARY_SEARCH_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/lower_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __binary_search {
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
- return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
- }
-
- template <forward_range _Range,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
- auto __ret = std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
- return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
- }
-};
-} // namespace __binary_search
-
-inline namespace __cpo {
-inline constexpr auto binary_search = __binary_search::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_BINARY_SEARCH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_clamp.h b/libcxx/include/__cxx03/__algorithm/ranges_clamp.h
deleted file mode 100644
index da4dda06a2255..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_clamp.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_CLAMP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_CLAMP_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __clamp {
-struct __fn {
- template <class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Type& operator()(
- const _Type& __value, const _Type& __low, const _Type& __high, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- !bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))),
- "Bad bounds passed to std::ranges::clamp");
-
- auto&& __projected = std::invoke(__proj, __value);
- if (std::invoke(__comp, std::forward<decltype(__projected)>(__projected), std::invoke(__proj, __low)))
- return __low;
- else if (std::invoke(__comp, std::invoke(__proj, __high), std::forward<decltype(__projected)>(__projected)))
- return __high;
- else
- return __value;
- }
-};
-} // namespace __clamp
-
-inline namespace __cpo {
-inline constexpr auto clamp = __clamp::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_CLAMP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_contains.h b/libcxx/include/__cxx03/__algorithm/ranges_contains.h
deleted file mode 100644
index 00b9d08c83c6c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_contains.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_H
-
-#include <__cxx03/__algorithm/ranges_find.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __contains {
-struct __fn {
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) {
- return ranges::find(std::move(__first), __last, __value, std::ref(__proj)) != __last;
- }
-
- template <input_range _Range, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static
- operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) {
- return ranges::find(ranges::begin(__range), ranges::end(__range), __value, std::ref(__proj)) !=
- ranges::end(__range);
- }
-};
-} // namespace __contains
-
-inline namespace __cpo {
-inline constexpr auto contains = __contains::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_contains_subrange.h b/libcxx/include/__cxx03/__algorithm/ranges_contains_subrange.h
deleted file mode 100644
index 6ac67b43ca6cc..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_contains_subrange.h
+++ /dev/null
@@ -1,97 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
-
-#include <__cxx03/__algorithm/ranges_search.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __contains_subrange {
-struct __fn {
- template <forward_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) {
- if (__first2 == __last2)
- return true;
-
- auto __ret = ranges::search(
- std::move(__first1), __last1, std::move(__first2), __last2, __pred, std::ref(__proj1), std::ref(__proj2));
- return __ret.empty() == false;
- }
-
- template <forward_range _Range1,
- forward_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool static
- operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) {
- if constexpr (sized_range<_Range2>) {
- if (ranges::size(__range2) == 0)
- return true;
- } else {
- if (ranges::begin(__range2) == ranges::end(__range2))
- return true;
- }
-
- auto __ret = ranges::search(__range1, __range2, __pred, std::ref(__proj1), std::ref(__proj2));
- return __ret.empty() == false;
- }
-};
-} // namespace __contains_subrange
-
-inline namespace __cpo {
-inline constexpr auto contains_subrange = __contains_subrange::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_CONTAINS_SUBRANGE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_copy.h
deleted file mode 100644
index e94a2089a692c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_copy.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_H
-
-#include <__cxx03/__algorithm/copy.h>
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __copy {
-struct __fn {
- template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result) const {
- auto __ret = std::__copy<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <input_range _Range, weakly_incrementable _OutIter>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __r, _OutIter __result) const {
- auto __ret = std::__copy<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-} // namespace __copy
-
-inline namespace __cpo {
-inline constexpr auto copy = __copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_copy_backward.h b/libcxx/include/__cxx03/__algorithm/ranges_copy_backward.h
deleted file mode 100644
index 90928177491f5..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_copy_backward.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_BACKWARD_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_BACKWARD_H
-
-#include <__cxx03/__algorithm/copy_backward.h>
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Ip, class _Op>
-using copy_backward_result = in_out_result<_Ip, _Op>;
-
-namespace __copy_backward {
-struct __fn {
- template <bidirectional_iterator _InIter1, sentinel_for<_InIter1> _Sent1, bidirectional_iterator _InIter2>
- requires indirectly_copyable<_InIter1, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2>
- operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const {
- auto __ret = std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <bidirectional_range _Range, bidirectional_iterator _Iter>
- requires indirectly_copyable<iterator_t<_Range>, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter>
- operator()(_Range&& __r, _Iter __result) const {
- auto __ret = std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-} // namespace __copy_backward
-
-inline namespace __cpo {
-inline constexpr auto copy_backward = __copy_backward::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_BACKWARD_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_copy_if.h b/libcxx/include/__cxx03/__algorithm/ranges_copy_if.h
deleted file mode 100644
index 814d408cb703e..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_copy_if.h
+++ /dev/null
@@ -1,87 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_IF_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Ip, class _Op>
-using copy_if_result = in_out_result<_Ip, _Op>;
-
-namespace __copy_if {
-struct __fn {
- template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static constexpr copy_if_result<_InIter, _OutIter>
- __copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first))) {
- *__result = *__first;
- ++__result;
- }
- }
- return {std::move(__first), std::move(__result)};
- }
-
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- requires indirectly_copyable<_Iter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<_Iter, _OutIter>
- operator()(_Iter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return __copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
- }
-
- template <input_range _Range,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __r, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return __copy_if_impl(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj);
- }
-};
-} // namespace __copy_if
-
-inline namespace __cpo {
-inline constexpr auto copy_if = __copy_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_copy_n.h b/libcxx/include/__cxx03/__algorithm/ranges_copy_n.h
deleted file mode 100644
index 67639e7c19aff..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_copy_n.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_N_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_N_H
-
-#include <__cxx03/__algorithm/copy.h>
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/unreachable_sentinel.h>
-#include <__cxx03/__iterator/wrap_iter.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _Ip, class _Op>
-using copy_n_result = in_out_result<_Ip, _Op>;
-
-namespace __copy_n {
-struct __fn {
- template <class _InIter, class _DiffType, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
- __go(_InIter __first, _DiffType __n, _OutIter __result) {
- while (__n != 0) {
- *__result = *__first;
- ++__first;
- ++__result;
- --__n;
- }
- return {std::move(__first), std::move(__result)};
- }
-
- template <random_access_iterator _InIter, class _DiffType, random_access_iterator _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
- __go(_InIter __first, _DiffType __n, _OutIter __result) {
- auto __ret = std::__copy<_RangeAlgPolicy>(__first, __first + __n, __result);
- return {__ret.first, __ret.second};
- }
-
- template <input_iterator _Ip, weakly_incrementable _Op>
- requires indirectly_copyable<_Ip, _Op>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op>
- operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const {
- return __go(std::move(__first), __n, std::move(__result));
- }
-};
-} // namespace __copy_n
-
-inline namespace __cpo {
-inline constexpr auto copy_n = __copy_n::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COPY_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_count.h b/libcxx/include/__cxx03/__algorithm/ranges_count.h
deleted file mode 100644
index b8553badfce02..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_count.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_H
-
-#include <__cxx03/__algorithm/count.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __count {
-struct __fn {
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
- return std::__count<_RangeAlgPolicy>(std::move(__first), std::move(__last), __value, __proj);
- }
-
- template <input_range _Range, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Range>
- operator()(_Range&& __r, const _Type& __value, _Proj __proj = {}) const {
- return std::__count<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __proj);
- }
-};
-} // namespace __count
-
-inline namespace __cpo {
-inline constexpr auto count = __count::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_count_if.h b/libcxx/include/__cxx03/__algorithm/ranges_count_if.h
deleted file mode 100644
index 10850c857d6df..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_count_if.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_IF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-template <class _Iter, class _Sent, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
-__count_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- iter_difference_t<_Iter> __counter(0);
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- ++__counter;
- }
- return __counter;
-}
-
-namespace __count_if {
-struct __fn {
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Predicate>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
- operator()(_Iter __first, _Sent __last, _Predicate __pred, _Proj __proj = {}) const {
- return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Predicate>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Range>
- operator()(_Range&& __r, _Predicate __pred, _Proj __proj = {}) const {
- return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
- }
-};
-} // namespace __count_if
-
-inline namespace __cpo {
-inline constexpr auto count_if = __count_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_COUNT_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_ends_with.h b/libcxx/include/__cxx03/__algorithm/ranges_ends_with.h
deleted file mode 100644
index 39dcb79559c22..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_ends_with.h
+++ /dev/null
@@ -1,201 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ENDS_WITH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ENDS_WITH_H
-
-#include <__cxx03/__algorithm/ranges_equal.h>
-#include <__cxx03/__algorithm/ranges_starts_with.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __ends_with {
-struct __fn {
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __ends_with_fn_impl_bidirectional(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- auto __rbegin1 = std::make_reverse_iterator(__last1);
- auto __rend1 = std::make_reverse_iterator(__first1);
- auto __rbegin2 = std::make_reverse_iterator(__last2);
- auto __rend2 = std::make_reverse_iterator(__first2);
- return ranges::starts_with(
- __rbegin1, __rend1, __rbegin2, __rend2, std::ref(__pred), std::ref(__proj1), std::ref(__proj2));
- }
-
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __ends_with_fn_impl(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- if constexpr (std::bidirectional_iterator<_Sent1> && std::bidirectional_iterator<_Sent2> &&
- (!std::random_access_iterator<_Sent1>) && (!std::random_access_iterator<_Sent2>)) {
- return __ends_with_fn_impl_bidirectional(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
-
- } else {
- auto __n1 = ranges::distance(__first1, __last1);
- auto __n2 = ranges::distance(__first2, __last2);
- if (__n2 == 0)
- return true;
- if (__n2 > __n1)
- return false;
-
- return __ends_with_fn_impl_with_offset(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- __pred,
- __proj1,
- __proj2,
- __n1 - __n2);
- }
- }
-
- template <class _Iter1,
- class _Sent1,
- class _Iter2,
- class _Sent2,
- class _Pred,
- class _Proj1,
- class _Proj2,
- class _Offset>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __ends_with_fn_impl_with_offset(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2,
- _Offset __offset) {
- if constexpr (std::bidirectional_iterator<_Sent1> && std::bidirectional_iterator<_Sent2> &&
- !std::random_access_iterator<_Sent1> && !std::random_access_iterator<_Sent2>) {
- return __ends_with_fn_impl_bidirectional(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
-
- } else {
- ranges::advance(__first1, __offset);
- return ranges::equal(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::ref(__pred),
- std::ref(__proj1),
- std::ref(__proj2));
- }
- }
-
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires(forward_iterator<_Iter1> || sized_sentinel_for<_Sent1, _Iter1>) &&
- (forward_iterator<_Iter2> || sized_sentinel_for<_Sent2, _Iter2>) &&
- indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __ends_with_fn_impl(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
- }
-
- template <input_range _Range1,
- input_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires(forward_range<_Range1> || sized_range<_Range1>) && (forward_range<_Range2> || sized_range<_Range2>) &&
- indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
- auto __n1 = ranges::size(__range1);
- auto __n2 = ranges::size(__range2);
- if (__n2 == 0)
- return true;
- if (__n2 > __n1)
- return false;
- auto __offset = __n1 - __n2;
-
- return __ends_with_fn_impl_with_offset(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2,
- __offset);
-
- } else {
- return __ends_with_fn_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
- }
- }
-};
-} // namespace __ends_with
-
-inline namespace __cpo {
-inline constexpr auto ends_with = __ends_with::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ENDS_WITH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_equal.h b/libcxx/include/__cxx03/__algorithm/ranges_equal.h
deleted file mode 100644
index abc701a9f1188..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_equal.h
+++ /dev/null
@@ -1,109 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_H
-
-#include <__cxx03/__algorithm/equal.h>
-#include <__cxx03/__algorithm/unwrap_range.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __equal {
-struct __fn {
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- if constexpr (sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>) {
- if (__last1 - __first1 != __last2 - __first2)
- return false;
- }
- auto __unwrapped1 = std::__unwrap_range(std::move(__first1), std::move(__last1));
- auto __unwrapped2 = std::__unwrap_range(std::move(__first2), std::move(__last2));
- return std::__equal_impl(
- std::move(__unwrapped1.first),
- std::move(__unwrapped1.second),
- std::move(__unwrapped2.first),
- std::move(__unwrapped2.second),
- __pred,
- __proj1,
- __proj2);
- }
-
- template <input_range _Range1,
- input_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
- if (ranges::distance(__range1) != ranges::distance(__range2))
- return false;
- }
- auto __unwrapped1 = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1));
- auto __unwrapped2 = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2));
- return std::__equal_impl(
- std::move(__unwrapped1.first),
- std::move(__unwrapped1.second),
- std::move(__unwrapped2.first),
- std::move(__unwrapped2.second),
- __pred,
- __proj1,
- __proj2);
- return false;
- }
-};
-} // namespace __equal
-
-inline namespace __cpo {
-inline constexpr auto equal = __equal::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_equal_range.h b/libcxx/include/__cxx03/__algorithm/ranges_equal_range.h
deleted file mode 100644
index 64e686704efd2..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_equal_range.h
+++ /dev/null
@@ -1,80 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_RANGE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_RANGE_H
-
-#include <__cxx03/__algorithm/equal_range.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __equal_range {
-
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<const _Tp*, projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__equal_range<_RangeAlgPolicy>(std::move(__first), std::move(__last), __value, __comp, __proj);
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <forward_range _Range,
- class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<const _Tp*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret =
- std::__equal_range<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), __value, __comp, __proj);
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-
-} // namespace __equal_range
-
-inline namespace __cpo {
-inline constexpr auto equal_range = __equal_range::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_EQUAL_RANGE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_fill.h b/libcxx/include/__cxx03/__algorithm/ranges_fill.h
deleted file mode 100644
index f85a1f4ed21c1..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_fill.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_H
-
-#include <__cxx03/__algorithm/ranges_fill_n.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __fill {
-struct __fn {
- template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
- if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
- return ranges::fill_n(__first, __last - __first, __value);
- } else {
- for (; __first != __last; ++__first)
- *__first = __value;
- return __first;
- }
- }
-
- template <class _Type, output_range<const _Type&> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const {
- return (*this)(ranges::begin(__range), ranges::end(__range), __value);
- }
-};
-} // namespace __fill
-
-inline namespace __cpo {
-inline constexpr auto fill = __fill::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_fill_n.h b/libcxx/include/__cxx03/__algorithm/ranges_fill_n.h
deleted file mode 100644
index 07f04c293451f..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_fill_n.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_N_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_N_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __fill_n {
-struct __fn {
- template <class _Type, output_iterator<const _Type&> _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, iter_difference_t<_Iter> __n, const _Type& __value) const {
- for (; __n != 0; --__n) {
- *__first = __value;
- ++__first;
- }
- return __first;
- }
-};
-} // namespace __fill_n
-
-inline namespace __cpo {
-inline constexpr auto fill_n = __fill_n::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FILL_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find.h b/libcxx/include/__cxx03/__algorithm/ranges_find.h
deleted file mode 100644
index 0b2c865476db0..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find.h
+++ /dev/null
@@ -1,80 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_H
-
-#include <__cxx03/__algorithm/find.h>
-#include <__cxx03/__algorithm/ranges_find_if.h>
-#include <__cxx03/__algorithm/unwrap_range.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __find {
-struct __fn {
- template <class _Iter, class _Sent, class _Tp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr _Iter
- __find_unwrap(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
- if constexpr (forward_iterator<_Iter>) {
- auto [__first_un, __last_un] = std::__unwrap_range(__first, std::move(__last));
- return std::__rewrap_range<_Sent>(
- std::move(__first), std::__find(std::move(__first_un), std::move(__last_un), __value, __proj));
- } else {
- return std::__find(std::move(__first), std::move(__last), __value, __proj);
- }
- }
-
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const {
- return __find_unwrap(std::move(__first), std::move(__last), __value, __proj);
- }
-
- template <input_range _Rp, class _Tp, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rp>, _Proj>, const _Tp*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
- operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const {
- return __find_unwrap(ranges::begin(__r), ranges::end(__r), __value, __proj);
- }
-};
-} // namespace __find
-
-inline namespace __cpo {
-inline constexpr auto find = __find::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find_end.h b/libcxx/include/__cxx03/__algorithm/ranges_find_end.h
deleted file mode 100644
index 117753b3d86b6..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find_end.h
+++ /dev/null
@@ -1,103 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_END_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_END_H
-
-#include <__cxx03/__algorithm/find_end.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/ranges_iterator_concept.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __find_end {
-struct __fn {
- template <forward_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter1> operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
- __first1,
- __last1,
- __first2,
- __last2,
- __pred,
- __proj1,
- __proj2,
- __iterator_concept<_Iter1>(),
- __iterator_concept<_Iter2>());
- return {__ret.first, __ret.second};
- }
-
- template <forward_range _Range1,
- forward_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range1> operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2,
- __iterator_concept<iterator_t<_Range1>>(),
- __iterator_concept<iterator_t<_Range2>>());
- return {__ret.first, __ret.second};
- }
-};
-} // namespace __find_end
-
-inline namespace __cpo {
-inline constexpr auto find_end = __find_end::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_END_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find_first_of.h b/libcxx/include/__cxx03/__algorithm/ranges_find_first_of.h
deleted file mode 100644
index ebf01681419ca..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find_first_of.h
+++ /dev/null
@@ -1,106 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_FIRST_OF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_FIRST_OF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __find_first_of {
-struct __fn {
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter1 __find_first_of_impl(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- for (; __first1 != __last1; ++__first1) {
- for (auto __j = __first2; __j != __last2; ++__j) {
- if (std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__j)))
- return __first1;
- }
- }
- return __first1;
- }
-
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter1 operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __find_first_of_impl(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
- }
-
- template <input_range _Range1,
- forward_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range1> operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return __find_first_of_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
- }
-};
-} // namespace __find_first_of
-
-inline namespace __cpo {
-inline constexpr auto find_first_of = __find_first_of::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_FIRST_OF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find_if.h b/libcxx/include/__cxx03/__algorithm/ranges_find_if.h
deleted file mode 100644
index a1098e0de1824..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find_if.h
+++ /dev/null
@@ -1,75 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Ip, class _Sp, class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- break;
- }
- return __first;
-}
-
-namespace __find_if {
-struct __fn {
- template <input_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
- operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
- }
-};
-} // namespace __find_if
-
-inline namespace __cpo {
-inline constexpr auto find_if = __find_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find_if_not.h b/libcxx/include/__cxx03/__algorithm/ranges_find_if_not.h
deleted file mode 100644
index 6bc8f16395873..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find_if_not.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_NOT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_NOT_H
-
-#include <__cxx03/__algorithm/ranges_find_if.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __find_if_not {
-struct __fn {
- template <input_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
- auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
- return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj);
- }
-
- template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
- operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
- auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
- return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj);
- }
-};
-} // namespace __find_if_not
-
-inline namespace __cpo {
-inline constexpr auto find_if_not = __find_if_not::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_IF_NOT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_find_last.h b/libcxx/include/__cxx03/__algorithm/ranges_find_last.h
deleted file mode 100644
index 506452c7c001d..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_find_last.h
+++ /dev/null
@@ -1,175 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_LAST_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_LAST_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/prev.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Sent, class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
-__find_last_impl(_Iter __first, _Sent __last, _Pred __pred, _Proj& __proj) {
- if (__first == __last) {
- return subrange<_Iter>(__first, __first);
- }
-
- if constexpr (bidirectional_iterator<_Iter>) {
- auto __last_it = ranges::next(__first, __last);
- for (auto __it = ranges::prev(__last_it); __it != __first; --__it) {
- if (__pred(std::invoke(__proj, *__it))) {
- return subrange<_Iter>(std::move(__it), std::move(__last_it));
- }
- }
- if (__pred(std::invoke(__proj, *__first))) {
- return subrange<_Iter>(std::move(__first), std::move(__last_it));
- }
- return subrange<_Iter>(__last_it, __last_it);
- } else {
- bool __found = false;
- _Iter __found_it;
- for (; __first != __last; ++__first) {
- if (__pred(std::invoke(__proj, *__first))) {
- __found = true;
- __found_it = __first;
- }
- }
-
- if (__found) {
- return subrange<_Iter>(std::move(__found_it), std::move(__first));
- } else {
- return subrange<_Iter>(__first, __first);
- }
- }
-}
-
-namespace __find_last {
-struct __fn {
- template <class _Type>
- struct __op {
- const _Type& __value;
- template <class _Elem>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const {
- return std::forward<_Elem>(__elem) == __value;
- }
- };
-
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter>
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) {
- return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Type>{__value}, __proj);
- }
-
- template <forward_range _Range, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range>
- operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) {
- return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Type>{__value}, __proj);
- }
-};
-} // namespace __find_last
-
-namespace __find_last_if {
-struct __fn {
- template <class _Pred>
- struct __op {
- _Pred& __pred;
- template <class _Elem>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const {
- return std::invoke(__pred, std::forward<_Elem>(__elem));
- }
- };
-
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) {
- return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Pred>{__pred}, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) {
- return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Pred>{__pred}, __proj);
- }
-};
-} // namespace __find_last_if
-
-namespace __find_last_if_not {
-struct __fn {
- template <class _Pred>
- struct __op {
- _Pred& __pred;
- template <class _Elem>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Elem&& __elem) const {
- return !std::invoke(__pred, std::forward<_Elem>(__elem));
- }
- };
-
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) {
- return ranges::__find_last_impl(std::move(__first), std::move(__last), __op<_Pred>{__pred}, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr static borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) {
- return ranges::__find_last_impl(ranges::begin(__range), ranges::end(__range), __op<_Pred>{__pred}, __proj);
- }
-};
-} // namespace __find_last_if_not
-
-inline namespace __cpo {
-inline constexpr auto find_last = __find_last::__fn{};
-inline constexpr auto find_last_if = __find_last_if::__fn{};
-inline constexpr auto find_last_if_not = __find_last_if_not::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FIND_LAST_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_for_each.h b/libcxx/include/__cxx03/__algorithm/ranges_for_each.h
deleted file mode 100644
index 3e926e9d2c4d1..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_for_each.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_H
-
-#include <__cxx03/__algorithm/in_fun_result.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Func>
-using for_each_result = in_fun_result<_Iter, _Func>;
-
-namespace __for_each {
-struct __fn {
-private:
- template <class _Iter, class _Sent, class _Proj, class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr static for_each_result<_Iter, _Func>
- __for_each_impl(_Iter __first, _Sent __last, _Func& __func, _Proj& __proj) {
- for (; __first != __last; ++__first)
- std::invoke(__func, std::invoke(__proj, *__first));
- return {std::move(__first), std::move(__func)};
- }
-
-public:
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr for_each_result<_Iter, _Func>
- operator()(_Iter __first, _Sent __last, _Func __func, _Proj __proj = {}) const {
- return __for_each_impl(std::move(__first), std::move(__last), __func, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirectly_unary_invocable<projected<iterator_t<_Range>, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr for_each_result<borrowed_iterator_t<_Range>, _Func>
- operator()(_Range&& __range, _Func __func, _Proj __proj = {}) const {
- return __for_each_impl(ranges::begin(__range), ranges::end(__range), __func, __proj);
- }
-};
-} // namespace __for_each
-
-inline namespace __cpo {
-inline constexpr auto for_each = __for_each::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_for_each_n.h b/libcxx/include/__cxx03/__algorithm/ranges_for_each_n.h
deleted file mode 100644
index 96df211298541..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_for_each_n.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_N_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_N_H
-
-#include <__cxx03/__algorithm/in_fun_result.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Func>
-using for_each_n_result = in_fun_result<_Iter, _Func>;
-
-namespace __for_each_n {
-struct __fn {
- template <input_iterator _Iter, class _Proj = identity, indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr for_each_n_result<_Iter, _Func>
- operator()(_Iter __first, iter_difference_t<_Iter> __count, _Func __func, _Proj __proj = {}) const {
- while (__count-- > 0) {
- std::invoke(__func, std::invoke(__proj, *__first));
- ++__first;
- }
- return {std::move(__first), std::move(__func)};
- }
-};
-} // namespace __for_each_n
-
-inline namespace __cpo {
-inline constexpr auto for_each_n = __for_each_n::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_FOR_EACH_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_generate.h b/libcxx/include/__cxx03/__algorithm/ranges_generate.h
deleted file mode 100644
index 96d43592d2a76..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_generate.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __generate {
-
-struct __fn {
- template <class _OutIter, class _Sent, class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr static _OutIter __generate_fn_impl(_OutIter __first, _Sent __last, _Func& __gen) {
- for (; __first != __last; ++__first) {
- *__first = __gen();
- }
-
- return __first;
- }
-
- template <input_or_output_iterator _OutIter, sentinel_for<_OutIter> _Sent, copy_constructible _Func>
- requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr _OutIter operator()(_OutIter __first, _Sent __last, _Func __gen) const {
- return __generate_fn_impl(std::move(__first), std::move(__last), __gen);
- }
-
- template <class _Range, copy_constructible _Func>
- requires invocable<_Func&> && output_range<_Range, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, _Func __gen) const {
- return __generate_fn_impl(ranges::begin(__range), ranges::end(__range), __gen);
- }
-};
-
-} // namespace __generate
-
-inline namespace __cpo {
-inline constexpr auto generate = __generate::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_generate_n.h b/libcxx/include/__cxx03/__algorithm/ranges_generate_n.h
deleted file mode 100644
index dd43e21618718..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_generate_n.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_N_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_N_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __generate_n {
-
-struct __fn {
- template <input_or_output_iterator _OutIter, copy_constructible _Func>
- requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr _OutIter
- operator()(_OutIter __first, iter_difference_t<_OutIter> __n, _Func __gen) const {
- for (; __n > 0; --__n) {
- *__first = __gen();
- ++__first;
- }
-
- return __first;
- }
-};
-
-} // namespace __generate_n
-
-inline namespace __cpo {
-inline constexpr auto generate_n = __generate_n::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_GENERATE_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_includes.h b/libcxx/include/__cxx03/__algorithm/ranges_includes.h
deleted file mode 100644
index 587a0eda16da5..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_includes.h
+++ /dev/null
@@ -1,98 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_INCLUDES_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_INCLUDES_H
-
-#include <__cxx03/__algorithm/includes.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __includes {
-
-struct __fn {
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return std::__includes(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__comp),
- std::move(__proj1),
- std::move(__proj2));
- }
-
- template <input_range _Range1,
- input_range _Range2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
- _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return std::__includes(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- std::move(__comp),
- std::move(__proj1),
- std::move(__proj2));
- }
-};
-
-} // namespace __includes
-
-inline namespace __cpo {
-inline constexpr auto includes = __includes::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_INCLUDES_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_inplace_merge.h b/libcxx/include/__cxx03/__algorithm/ranges_inplace_merge.h
deleted file mode 100644
index 34668f4d57baf..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_inplace_merge.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_INPLACE_MERGE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_INPLACE_MERGE_H
-
-#include <__cxx03/__algorithm/inplace_merge.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __inplace_merge {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __inplace_merge_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp&& __comp, _Proj&& __proj) {
- auto __last_iter = ranges::next(__middle, __last);
- std::__inplace_merge<_RangeAlgPolicy>(
- std::move(__first), std::move(__middle), __last_iter, std::__make_projected(__comp, __proj));
- return __last_iter;
- }
-
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI _Iter
- operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __inplace_merge_impl(
- std::move(__first), std::move(__middle), std::move(__last), std::move(__comp), std::move(__proj));
- }
-
- template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range>
- operator()(_Range&& __range, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const {
- return __inplace_merge_impl(
- ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__comp), std::move(__proj));
- }
-};
-
-} // namespace __inplace_merge
-
-inline namespace __cpo {
-inline constexpr auto inplace_merge = __inplace_merge::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_INPLACE_MERGE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_heap.h b/libcxx/include/__cxx03/__algorithm/ranges_is_heap.h
deleted file mode 100644
index 47112bdddd057..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_heap.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_H
-
-#include <__cxx03/__algorithm/is_heap_until.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __is_heap {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool
- __is_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
-
- auto __result = std::__is_heap_until(std::move(__first), std::move(__last_iter), __projected_comp);
- return __result == __last;
- }
-
- template <random_access_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __is_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- return __is_heap_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
- }
-};
-
-} // namespace __is_heap
-
-inline namespace __cpo {
-inline constexpr auto is_heap = __is_heap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_heap_until.h b/libcxx/include/__cxx03/__algorithm/ranges_is_heap_until.h
deleted file mode 100644
index d7176f784037c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_heap_until.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
-
-#include <__cxx03/__algorithm/is_heap_until.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __is_heap_until {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __is_heap_until_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
-
- return std::__is_heap_until(std::move(__first), std::move(__last_iter), __projected_comp);
- }
-
- template <random_access_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __is_heap_until_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- return __is_heap_until_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
- }
-};
-
-} // namespace __is_heap_until
-
-inline namespace __cpo {
-inline constexpr auto is_heap_until = __is_heap_until::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_partitioned.h b/libcxx/include/__cxx03/__algorithm/ranges_is_partitioned.h
deleted file mode 100644
index d746f55322e78..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_partitioned.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PARTITIONED_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PARTITIONED_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __is_partitioned {
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool
- __is_partitioned_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (!std::invoke(__pred, std::invoke(__proj, *__first)))
- break;
- }
-
- if (__first == __last)
- return true;
- ++__first;
-
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- return false;
- }
-
- return true;
- }
-
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return __is_partitioned_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __is_partitioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __is_partitioned
-
-inline namespace __cpo {
-inline constexpr auto is_partitioned = __is_partitioned::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PARTITIONED_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_permutation.h b/libcxx/include/__cxx03/__algorithm/ranges_is_permutation.h
deleted file mode 100644
index 31d85e5fb27cd..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_permutation.h
+++ /dev/null
@@ -1,107 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PERMUTATION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PERMUTATION_H
-
-#include <__cxx03/__algorithm/is_permutation.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __is_permutation {
-struct __fn {
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool __is_permutation_func_impl(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- return std::__is_permutation<_RangeAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
- }
-
- template <
- forward_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_equivalence_relation<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Pred = ranges::equal_to>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __is_permutation_func_impl(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
- }
-
- template <forward_range _Range1,
- forward_range _Range2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_equivalence_relation<projected<iterator_t<_Range1>, _Proj1>,
- projected<iterator_t<_Range2>, _Proj2>> _Pred = ranges::equal_to>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
- if (ranges::distance(__range1) != ranges::distance(__range2))
- return false;
- }
-
- return __is_permutation_func_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
- }
-};
-} // namespace __is_permutation
-
-inline namespace __cpo {
-inline constexpr auto is_permutation = __is_permutation::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_IS_PERMUTATION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_sorted.h b/libcxx/include/__cxx03/__algorithm/ranges_is_sorted.h
deleted file mode 100644
index f5c4e6f4191ad..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_sorted.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_H
-#define _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_H
-
-#include <__cxx03/__algorithm/ranges_is_sorted_until.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __is_sorted {
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return ranges::__is_sorted_until_impl(std::move(__first), __last, __comp, __proj) == __last;
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __last = ranges::end(__range);
- return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last;
- }
-};
-} // namespace __is_sorted
-
-inline namespace __cpo {
-inline constexpr auto is_sorted = __is_sorted::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_is_sorted_until.h b/libcxx/include/__cxx03/__algorithm/ranges_is_sorted_until.h
deleted file mode 100644
index 701c01749c260..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_is_sorted_until.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_UNTIL_H
-#define _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_UNTIL_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Sent, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Iter
-__is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- if (__first == __last)
- return __first;
- auto __i = __first;
- while (++__i != __last) {
- if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first)))
- return __i;
- __first = __i;
- }
- return __i;
-}
-
-namespace __is_sorted_until {
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return ranges::__is_sorted_until_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- return ranges::__is_sorted_until_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
- }
-};
-} // namespace __is_sorted_until
-
-inline namespace __cpo {
-inline constexpr auto is_sorted_until = __is_sorted_until::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03__ALGORITHM_RANGES_IS_SORTED_UNTIL_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_iterator_concept.h b/libcxx/include/__cxx03/__algorithm/ranges_iterator_concept.h
deleted file mode 100644
index 1ff6328cfc150..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_iterator_concept.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _IterMaybeQualified>
-consteval auto __get_iterator_concept() {
- using _Iter = __remove_cvref_t<_IterMaybeQualified>;
-
- if constexpr (contiguous_iterator<_Iter>)
- return contiguous_iterator_tag();
- else if constexpr (random_access_iterator<_Iter>)
- return random_access_iterator_tag();
- else if constexpr (bidirectional_iterator<_Iter>)
- return bidirectional_iterator_tag();
- else if constexpr (forward_iterator<_Iter>)
- return forward_iterator_tag();
- else if constexpr (input_iterator<_Iter>)
- return input_iterator_tag();
-}
-
-template <class _Iter>
-using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
-
-} // namespace ranges
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_lexicographical_compare.h b/libcxx/include/__cxx03/__algorithm/ranges_lexicographical_compare.h
deleted file mode 100644
index e3fec1c416519..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_lexicographical_compare.h
+++ /dev/null
@@ -1,106 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __lexicographical_compare {
-struct __fn {
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool __lexicographical_compare_impl(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Comp& __comp,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- while (__first2 != __last2) {
- if (__first1 == __last1 || std::invoke(__comp, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2)))
- return true;
- if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1)))
- return false;
- ++__first1;
- ++__first2;
- }
- return false;
- }
-
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __lexicographical_compare_impl(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __comp, __proj1, __proj2);
- }
-
- template <input_range _Range1,
- input_range _Range2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
- _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
- _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return __lexicographical_compare_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __comp,
- __proj1,
- __proj2);
- }
-};
-} // namespace __lexicographical_compare
-
-inline namespace __cpo {
-inline constexpr auto lexicographical_compare = __lexicographical_compare::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_lower_bound.h b/libcxx/include/__cxx03/__algorithm/ranges_lower_bound.h
deleted file mode 100644
index bed4c815e5b4f..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_lower_bound.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_LOWER_BOUND_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_LOWER_BOUND_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/lower_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-namespace __lower_bound {
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- return std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
- }
-
- template <forward_range _Range,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- return std::__lower_bound<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj);
- }
-};
-} // namespace __lower_bound
-
-inline namespace __cpo {
-inline constexpr auto lower_bound = __lower_bound::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_LOWER_BOUND_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_make_heap.h b/libcxx/include/__cxx03/__algorithm/ranges_make_heap.h
deleted file mode 100644
index ba8ccb89baad6..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_make_heap.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MAKE_HEAP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MAKE_HEAP_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_heap.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __make_heap {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __make_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__make_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __make_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __make_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __make_heap
-
-inline namespace __cpo {
-inline constexpr auto make_heap = __make_heap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MAKE_HEAP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_max.h b/libcxx/include/__cxx03/__algorithm/ranges_max.h
deleted file mode 100644
index 58ea541d3e493..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_max.h
+++ /dev/null
@@ -1,103 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_H
-
-#include <__cxx03/__algorithm/ranges_min_element.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __max {
-struct __fn {
- template <class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
- operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
- _LIBCPP_LIFETIMEBOUND const _Tp& __b,
- _Comp __comp = {},
- _Proj __proj = {}) const {
- return std::invoke(__comp, std::invoke(__proj, __a), std::invoke(__proj, __b)) ? __b : __a;
- }
-
- template <copyable _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp
- operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __il.begin() != __il.end(), "initializer_list must contain at least one element");
-
- auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); };
- return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj);
- }
-
- template <input_range _Rp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_value_t<_Rp>
- operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
-
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element");
-
- if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
- auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool {
- return std::invoke(__comp, __rhs, __lhs);
- };
- return *ranges::__min_element_impl(std::move(__first), std::move(__last), __comp_lhs_rhs_swapped, __proj);
- } else {
- range_value_t<_Rp> __result = *__first;
- while (++__first != __last) {
- if (std::invoke(__comp, std::invoke(__proj, __result), std::invoke(__proj, *__first)))
- __result = *__first;
- }
- return __result;
- }
- }
-};
-} // namespace __max
-
-inline namespace __cpo {
-inline constexpr auto max = __max::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_max_element.h b/libcxx/include/__cxx03/__algorithm/ranges_max_element.h
deleted file mode 100644
index cbe50d1bf4127..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_max_element.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_ELEMENT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_ELEMENT_H
-
-#include <__cxx03/__algorithm/ranges_min_element.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __max_element {
-struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); };
- return ranges::__min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj);
- }
-
- template <forward_range _Rp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
- operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); };
- return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj);
- }
-};
-} // namespace __max_element
-
-inline namespace __cpo {
-inline constexpr auto max_element = __max_element::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MAX_ELEMENT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_merge.h b/libcxx/include/__cxx03/__algorithm/ranges_merge.h
deleted file mode 100644
index 8b8b8fbbab2cb..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_merge.h
+++ /dev/null
@@ -1,138 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MERGE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MERGE_H
-
-#include <__cxx03/__algorithm/in_in_out_result.h>
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/mergeable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2, class _OutIter>
-using merge_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
-
-namespace __merge {
-
-template < class _InIter1,
- class _Sent1,
- class _InIter2,
- class _Sent2,
- class _OutIter,
- class _Comp,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI constexpr merge_result<__remove_cvref_t<_InIter1>,
- __remove_cvref_t<_InIter2>,
- __remove_cvref_t<_OutIter>>
-__merge_impl(_InIter1&& __first1,
- _Sent1&& __last1,
- _InIter2&& __first2,
- _Sent2&& __last2,
- _OutIter&& __result,
- _Comp&& __comp,
- _Proj1&& __proj1,
- _Proj2&& __proj2) {
- for (; __first1 != __last1 && __first2 != __last2; ++__result) {
- if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) {
- *__result = *__first2;
- ++__first2;
- } else {
- *__result = *__first1;
- ++__first1;
- }
- }
- auto __ret1 = ranges::copy(std::move(__first1), std::move(__last1), std::move(__result));
- auto __ret2 = ranges::copy(std::move(__first2), std::move(__last2), std::move(__ret1.out));
- return {std::move(__ret1.in), std::move(__ret2.in), std::move(__ret2.out)};
-}
-
-struct __fn {
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr merge_result<_InIter1, _InIter2, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __merge::__merge_impl(__first1, __last1, __first2, __last2, __result, __comp, __proj1, __proj2);
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr merge_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __merge::__merge_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __result,
- __comp,
- __proj1,
- __proj2);
- }
-};
-
-} // namespace __merge
-
-inline namespace __cpo {
-inline constexpr auto merge = __merge::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MERGE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_min.h b/libcxx/include/__cxx03/__algorithm/ranges_min.h
deleted file mode 100644
index 72f06e72e3003..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_min.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_H
-
-#include <__cxx03/__algorithm/ranges_min_element.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __min {
-struct __fn {
- template <class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
- operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
- _LIBCPP_LIFETIMEBOUND const _Tp& __b,
- _Comp __comp = {},
- _Proj __proj = {}) const {
- return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a;
- }
-
- template <copyable _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp
- operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __il.begin() != __il.end(), "initializer_list must contain at least one element");
- return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj);
- }
-
- template <input_range _Rp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_value_t<_Rp>
- operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range must contain at least one element");
- if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
- return *ranges::__min_element_impl(__first, __last, __comp, __proj);
- } else {
- range_value_t<_Rp> __result = *__first;
- while (++__first != __last) {
- if (std::invoke(__comp, std::invoke(__proj, *__first), std::invoke(__proj, __result)))
- __result = *__first;
- }
- return __result;
- }
- }
-};
-} // namespace __min
-
-inline namespace __cpo {
-inline constexpr auto min = __min::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_min_element.h b/libcxx/include/__cxx03/__algorithm/ranges_min_element.h
deleted file mode 100644
index b3854233966b0..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_min_element.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_ELEMENT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_ELEMENT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-// TODO(ranges): `ranges::min_element` can now simply delegate to `std::__min_element`.
-template <class _Ip, class _Sp, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
- if (__first == __last)
- return __first;
-
- _Ip __i = __first;
- while (++__i != __last)
- if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first)))
- __first = __i;
- return __first;
-}
-
-namespace __min_element {
-struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return ranges::__min_element_impl(__first, __last, __comp, __proj);
- }
-
- template <forward_range _Rp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
- operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-} // namespace __min_element
-
-inline namespace __cpo {
-inline constexpr auto min_element = __min_element::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MIN_ELEMENT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_minmax.h b/libcxx/include/__cxx03/__algorithm/ranges_minmax.h
deleted file mode 100644
index 8ce4e438382e5..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_minmax.h
+++ /dev/null
@@ -1,175 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_H
-
-#include <__cxx03/__algorithm/min_max_result.h>
-#include <__cxx03/__algorithm/minmax_element.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/desugars_to.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-template <class _T1>
-using minmax_result = min_max_result<_T1>;
-
-namespace __minmax {
-struct __fn {
- template <class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&>
- operator()(_LIBCPP_LIFETIMEBOUND const _Type& __a,
- _LIBCPP_LIFETIMEBOUND const _Type& __b,
- _Comp __comp = {},
- _Proj __proj = {}) const {
- if (std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)))
- return {__b, __a};
- return {__a, __b};
- }
-
- template <copyable _Type,
- class _Proj = identity,
- indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type>
- operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __il.begin() != __il.end(), "initializer_list has to contain at least one element");
- auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj);
- return ranges::minmax_result<_Type>{*__iters.first, *__iters.second};
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- requires indirectly_copyable_storable<iterator_t<_Range>, range_value_t<_Range>*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<range_value_t<_Range>>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
- using _ValueT = range_value_t<_Range>;
-
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__first != __last, "range has to contain at least one element");
-
- // This optimiation is not in minmax_element because clang doesn't see through the pointers and as a result doesn't
- // vectorize the code.
- if constexpr (contiguous_range<_Range> && is_integral_v<_ValueT> &&
- __is_cheap_to_copy<_ValueT> & __is_identity<_Proj>::value &&
- __desugars_to_v<__less_tag, _Comp, _ValueT, _ValueT>) {
- minmax_result<_ValueT> __result = {__r[0], __r[0]};
- for (auto __e : __r) {
- if (__e < __result.min)
- __result.min = __e;
- if (__result.max < __e)
- __result.max = __e;
- }
- return __result;
- } else if constexpr (forward_range<_Range>) {
- // Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator
- // dereference when doing so might not be idempotent. The `if constexpr` avoids the extra branch in cases where
- // it's not needed.
- if constexpr (!same_as<remove_cvref_t<range_reference_t<_Range>>, _ValueT> ||
- is_rvalue_reference_v<range_reference_t<_Range>>) {
- if (ranges::next(__first) == __last) {
- // During initialization, members are allowed to refer to already initialized members
- // (see http://eel.is/c++draft/dcl.init.aggr#6)
- minmax_result<_ValueT> __result = {*__first, __result.min};
- return __result;
- }
- }
- auto __result = std::__minmax_element_impl(__first, __last, __comp, __proj);
- return {*__result.first, *__result.second};
- } else {
- // input_iterators can't be copied, so the implementation for input_iterators has to store
- // the values instead of a pointer to the correct values
- auto __less = [&](auto&& __a, auto&& __b) -> bool {
- return std::invoke(__comp,
- std::invoke(__proj, std::forward<decltype(__a)>(__a)),
- std::invoke(__proj, std::forward<decltype(__b)>(__b)));
- };
-
- // During initialization, members are allowed to refer to already initialized members
- // (see http://eel.is/c++draft/dcl.init.aggr#6)
- ranges::minmax_result<_ValueT> __result = {*__first, __result.min};
- if (__first == __last || ++__first == __last)
- return __result;
-
- if (__less(*__first, __result.min))
- __result.min = *__first;
- else
- __result.max = *__first;
-
- while (++__first != __last) {
- _ValueT __i = *__first;
- if (++__first == __last) {
- if (__less(__i, __result.min))
- __result.min = __i;
- else if (!__less(__i, __result.max))
- __result.max = __i;
- return __result;
- }
-
- if (__less(*__first, __i)) {
- if (__less(*__first, __result.min))
- __result.min = *__first;
- if (!__less(__i, __result.max))
- __result.max = std::move(__i);
- } else {
- if (__less(__i, __result.min))
- __result.min = std::move(__i);
- if (!__less(*__first, __result.max))
- __result.max = *__first;
- }
- }
- return __result;
- }
- }
-};
-} // namespace __minmax
-
-inline namespace __cpo {
-inline constexpr auto minmax = __minmax::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_minmax_element.h b/libcxx/include/__cxx03/__algorithm/ranges_minmax_element.h
deleted file mode 100644
index 1e92a63a9d33e..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_minmax_element.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_ELEMENT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_ELEMENT_H
-
-#include <__cxx03/__algorithm/min_max_result.h>
-#include <__cxx03/__algorithm/minmax_element.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _T1>
-using minmax_element_result = min_max_result<_T1>;
-
-namespace __minmax_element {
-struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<_Ip>
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__minmax_element_impl(std::move(__first), std::move(__last), __comp, __proj);
- return {__ret.first, __ret.second};
- }
-
- template <forward_range _Rp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<borrowed_iterator_t<_Rp>>
- operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__minmax_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- return {__ret.first, __ret.second};
- }
-};
-} // namespace __minmax_element
-
-inline namespace __cpo {
-inline constexpr auto minmax_element = __minmax_element::__fn{};
-} // namespace __cpo
-
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MINMAX_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_mismatch.h b/libcxx/include/__cxx03/__algorithm/ranges_mismatch.h
deleted file mode 100644
index d3ebb7ded9c0b..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_mismatch.h
+++ /dev/null
@@ -1,100 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MISMATCH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MISMATCH_H
-
-#include <__cxx03/__algorithm/in_in_result.h>
-#include <__cxx03/__algorithm/mismatch.h>
-#include <__cxx03/__algorithm/unwrap_range.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _I1, class _I2>
-using mismatch_result = in_in_result<_I1, _I2>;
-
-namespace __mismatch {
-struct __fn {
- template <class _I1, class _S1, class _I2, class _S2, class _Pred, class _Proj1, class _Proj2>
- static _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2>
- __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
- if constexpr (forward_iterator<_I1> && forward_iterator<_I2>) {
- auto __range1 = std::__unwrap_range(__first1, __last1);
- auto __range2 = std::__unwrap_range(__first2, __last2);
- auto __res =
- std::__mismatch(__range1.first, __range1.second, __range2.first, __range2.second, __pred, __proj1, __proj2);
- return {std::__rewrap_range<_S1>(__first1, __res.first), std::__rewrap_range<_S2>(__first2, __res.second)};
- } else {
- auto __res = std::__mismatch(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
- return {std::move(__res.first), std::move(__res.second)};
- }
- }
-
- template <input_iterator _I1,
- sentinel_for<_I1> _S1,
- input_iterator _I2,
- sentinel_for<_I2> _S2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_I1, _I2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2> operator()(
- _I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {})
- const {
- return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2);
- }
-
- template <input_range _R1,
- input_range _R2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]]
- _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
- operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return __go(
- ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), __pred, __proj1, __proj2);
- }
-};
-} // namespace __mismatch
-
-inline namespace __cpo {
-constexpr inline auto mismatch = __mismatch::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MISMATCH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_move.h b/libcxx/include/__cxx03/__algorithm/ranges_move.h
deleted file mode 100644
index e20f4d8854db2..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_move.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/move.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using move_result = in_out_result<_InIter, _OutIter>;
-
-namespace __move {
-struct __fn {
- template <class _InIter, class _Sent, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static move_result<_InIter, _OutIter>
- __move_impl(_InIter __first, _Sent __last, _OutIter __result) {
- auto __ret = std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
- requires indirectly_movable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr move_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result) const {
- return __move_impl(std::move(__first), std::move(__last), std::move(__result));
- }
-
- template <input_range _Range, weakly_incrementable _OutIter>
- requires indirectly_movable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr move_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result) const {
- return __move_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
- }
-};
-} // namespace __move
-
-inline namespace __cpo {
-inline constexpr auto move = __move::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_move_backward.h b/libcxx/include/__cxx03/__algorithm/ranges_move_backward.h
deleted file mode 100644
index cecaa7d8d657b..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_move_backward.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_BACKWARD_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_BACKWARD_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/move_backward.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using move_backward_result = in_out_result<_InIter, _OutIter>;
-
-namespace __move_backward {
-struct __fn {
- template <class _InIter, class _Sent, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static move_backward_result<_InIter, _OutIter>
- __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) {
- auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter>
- requires indirectly_movable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result) const {
- return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result));
- }
-
- template <bidirectional_range _Range, bidirectional_iterator _Iter>
- requires indirectly_movable<iterator_t<_Range>, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter>
- operator()(_Range&& __range, _Iter __result) const {
- return __move_backward_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
- }
-};
-} // namespace __move_backward
-
-inline namespace __cpo {
-inline constexpr auto move_backward = __move_backward::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_MOVE_BACKWARD_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_next_permutation.h b/libcxx/include/__cxx03/__algorithm/ranges_next_permutation.h
deleted file mode 100644
index 337c7a892cfba..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_next_permutation.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_NEXT_PERMUTATION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_NEXT_PERMUTATION_H
-
-#include <__cxx03/__algorithm/in_found_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/next_permutation.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter>
-using next_permutation_result = in_found_result<_InIter>;
-
-namespace __next_permutation {
-
-struct __fn {
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr next_permutation_result<_Iter>
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __result = std::__next_permutation<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr next_permutation_result<borrowed_iterator_t<_Range>>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __result = std::__next_permutation<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
- return {std::move(__result.first), std::move(__result.second)};
- }
-};
-
-} // namespace __next_permutation
-
-inline namespace __cpo {
-constexpr inline auto next_permutation = __next_permutation::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_NEXT_PERMUTATION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_none_of.h b/libcxx/include/__cxx03/__algorithm/ranges_none_of.h
deleted file mode 100644
index 461fbc87c5d24..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_none_of.h
+++ /dev/null
@@ -1,75 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_NONE_OF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_NONE_OF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __none_of {
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static bool
- __none_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- return false;
- }
- return true;
- }
-
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
- return __none_of_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <input_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __none_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __none_of
-
-inline namespace __cpo {
-inline constexpr auto none_of = __none_of::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_NONE_OF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_nth_element.h b/libcxx/include/__cxx03/__algorithm/ranges_nth_element.h
deleted file mode 100644
index 27bf33e7703de..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_nth_element.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_NTH_ELEMENT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_NTH_ELEMENT_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/nth_element.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __nth_element {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __nth_element_fn_impl(_Iter __first, _Iter __nth, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__nth_element_impl<_RangeAlgPolicy>(std::move(__first), std::move(__nth), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Iter __nth, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __nth_element_fn_impl(std::move(__first), std::move(__nth), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, iterator_t<_Range> __nth, _Comp __comp = {}, _Proj __proj = {}) const {
- return __nth_element_fn_impl(ranges::begin(__r), std::move(__nth), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __nth_element
-
-inline namespace __cpo {
-inline constexpr auto nth_element = __nth_element::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_NTH_ELEMENT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_partial_sort.h b/libcxx/include/__cxx03/__algorithm/ranges_partial_sort.h
deleted file mode 100644
index 06aab77f65f3c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_partial_sort.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/partial_sort.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __partial_sort {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __partial_sort_fn_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- return std::__partial_sort<_RangeAlgPolicy>(std::move(__first), std::move(__middle), __last, __projected_comp);
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __partial_sort_fn_impl(std::move(__first), std::move(__middle), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const {
- return __partial_sort_fn_impl(ranges::begin(__r), std::move(__middle), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __partial_sort
-
-inline namespace __cpo {
-inline constexpr auto partial_sort = __partial_sort::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_partial_sort_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_partial_sort_copy.h
deleted file mode 100644
index 3fda0e58e74d0..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_partial_sort_copy.h
+++ /dev/null
@@ -1,114 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/partial_sort_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using partial_sort_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __partial_sort_copy {
-
-struct __fn {
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- random_access_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_copyable<_Iter1, _Iter2> && sortable<_Iter2, _Comp, _Proj2> &&
- indirect_strict_weak_order<_Comp, projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>>
- _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<_Iter1, _Iter2> operator()(
- _Iter1 __first,
- _Sent1 __last,
- _Iter2 __result_first,
- _Sent2 __result_last,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
- std::move(__first),
- std::move(__last),
- std::move(__result_first),
- std::move(__result_last),
- __comp,
- __proj1,
- __proj2);
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <input_range _Range1,
- random_access_range _Range2,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_copyable<iterator_t<_Range1>, iterator_t<_Range2>> &&
- sortable<iterator_t<_Range2>, _Comp, _Proj2> &&
- indirect_strict_weak_order<_Comp,
- projected<iterator_t<_Range1>, _Proj1>,
- projected<iterator_t<_Range2>, _Proj2>>
- _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>>
- operator()(
- _Range1&& __range, _Range2&& __result_range, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
- ranges::begin(__range),
- ranges::end(__range),
- ranges::begin(__result_range),
- ranges::end(__result_range),
- __comp,
- __proj1,
- __proj2);
- return {std::move(__result.first), std::move(__result.second)};
- }
-};
-
-} // namespace __partial_sort_copy
-
-inline namespace __cpo {
-inline constexpr auto partial_sort_copy = __partial_sort_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_partition.h b/libcxx/include/__cxx03/__algorithm/ranges_partition.h
deleted file mode 100644
index 261972ada5683..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_partition.h
+++ /dev/null
@@ -1,88 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/partition.h>
-#include <__cxx03/__algorithm/ranges_iterator_concept.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __partition {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static constexpr subrange<__remove_cvref_t<_Iter>>
- __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
- auto&& __projected_pred = std::__make_projected(__pred, __proj);
- auto __result = std::__partition<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), __projected_pred, __iterator_concept<_Iter>());
-
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <permutable _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return __partition_fn_impl(__first, __last, __pred, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-
-} // namespace __partition
-
-inline namespace __cpo {
-inline constexpr auto partition = __partition::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_partition_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_partition_copy.h
deleted file mode 100644
index c80108022d096..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_partition_copy.h
+++ /dev/null
@@ -1,110 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_COPY_H
-
-#include <__cxx03/__algorithm/in_out_out_result.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter1, class _OutIter2>
-using partition_copy_result = in_out_out_result<_InIter, _OutIter1, _OutIter2>;
-
-namespace __partition_copy {
-
-struct __fn {
- // TODO(ranges): delegate to the classic algorithm.
- template <class _InIter, class _Sent, class _OutIter1, class _OutIter2, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static partition_copy_result<__remove_cvref_t<_InIter>,
- __remove_cvref_t<_OutIter1>,
- __remove_cvref_t<_OutIter2> >
- __partition_copy_fn_impl(
- _InIter&& __first,
- _Sent&& __last,
- _OutIter1&& __out_true,
- _OutIter2&& __out_false,
- _Pred& __pred,
- _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first))) {
- *__out_true = *__first;
- ++__out_true;
-
- } else {
- *__out_false = *__first;
- ++__out_false;
- }
- }
-
- return {std::move(__first), std::move(__out_true), std::move(__out_false)};
- }
-
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter1,
- weakly_incrementable _OutIter2,
- class _Proj = identity,
- indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter1> && indirectly_copyable<_InIter, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr partition_copy_result<_InIter, _OutIter1, _OutIter2> operator()(
- _InIter __first, _Sent __last, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {})
- const {
- return __partition_copy_fn_impl(
- std::move(__first), std::move(__last), std::move(__out_true), std::move(__out_false), __pred, __proj);
- }
-
- template <input_range _Range,
- weakly_incrementable _OutIter1,
- weakly_incrementable _OutIter2,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter1> && indirectly_copyable<iterator_t<_Range>, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr partition_copy_result<borrowed_iterator_t<_Range>, _OutIter1, _OutIter2>
- operator()(_Range&& __range, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {}) const {
- return __partition_copy_fn_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__out_true), std::move(__out_false), __pred, __proj);
- }
-};
-
-} // namespace __partition_copy
-
-inline namespace __cpo {
-inline constexpr auto partition_copy = __partition_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_partition_point.h b/libcxx/include/__cxx03/__algorithm/ranges_partition_point.h
deleted file mode 100644
index 337e1261f01c5..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_partition_point.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_POINT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_POINT_H
-
-#include <__cxx03/__algorithm/half_positive.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __partition_point {
-
-struct __fn {
- // TODO(ranges): delegate to the classic algorithm.
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __partition_point_fn_impl(_Iter&& __first, _Sent&& __last, _Pred& __pred, _Proj& __proj) {
- auto __len = ranges::distance(__first, __last);
-
- while (__len != 0) {
- auto __half_len = std::__half_positive(__len);
- auto __mid = ranges::next(__first, __half_len);
-
- if (std::invoke(__pred, std::invoke(__proj, *__mid))) {
- __first = ++__mid;
- __len -= __half_len + 1;
-
- } else {
- __len = __half_len;
- }
- }
-
- return __first;
- }
-
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return __partition_point_fn_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __partition_point_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-
-} // namespace __partition_point
-
-inline namespace __cpo {
-inline constexpr auto partition_point = __partition_point::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PARTITION_POINT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_pop_heap.h b/libcxx/include/__cxx03/__algorithm/ranges_pop_heap.h
deleted file mode 100644
index ecbfb44888edf..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_pop_heap.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_POP_HEAP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_POP_HEAP_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/pop_heap.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __pop_heap {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __pop_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
- auto __len = __last_iter - __first;
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__pop_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp, __len);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __pop_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __pop_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __pop_heap
-
-inline namespace __cpo {
-inline constexpr auto pop_heap = __pop_heap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_POP_HEAP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_prev_permutation.h b/libcxx/include/__cxx03/__algorithm/ranges_prev_permutation.h
deleted file mode 100644
index ded9eb2c47155..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_prev_permutation.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PREV_PERMUTATION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PREV_PERMUTATION_H
-
-#include <__cxx03/__algorithm/in_found_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/prev_permutation.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter>
-using prev_permutation_result = in_found_result<_InIter>;
-
-namespace __prev_permutation {
-
-struct __fn {
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<_Iter>
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __result = std::__prev_permutation<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<borrowed_iterator_t<_Range>>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __result = std::__prev_permutation<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
- return {std::move(__result.first), std::move(__result.second)};
- }
-};
-
-} // namespace __prev_permutation
-
-inline namespace __cpo {
-constexpr inline auto prev_permutation = __prev_permutation::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PREV_PERMUTATION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_push_heap.h b/libcxx/include/__cxx03/__algorithm/ranges_push_heap.h
deleted file mode 100644
index 33479d9bfad66..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_push_heap.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_PUSH_HEAP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_PUSH_HEAP_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/push_heap.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __push_heap {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __push_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__push_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __push_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __push_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __push_heap
-
-inline namespace __cpo {
-inline constexpr auto push_heap = __push_heap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_PUSH_HEAP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_remove.h b/libcxx/include/__cxx03/__algorithm/ranges_remove.h
deleted file mode 100644
index 13b4efb9f5c3b..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_remove.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_H
-#include <__cxx03/__config>
-
-#include <__cxx03/__algorithm/ranges_remove_if.h>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __remove {
-struct __fn {
- template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __other) -> bool { return __value == __other; };
- return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <forward_range _Range, class _Type, class _Proj = identity>
- requires permutable<iterator_t<_Range>> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __other) -> bool { return __value == __other; };
- return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __remove
-
-inline namespace __cpo {
-inline constexpr auto remove = __remove::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_remove_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_remove_copy.h
deleted file mode 100644
index 47c2d6c086920..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_remove_copy.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/ranges_remove_copy_if.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using remove_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __remove_copy {
-
-struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- class _Type,
- class _Proj = identity>
- requires indirectly_copyable<_InIter, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _Type*>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __val) -> bool { return __value == __val; };
- return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
- }
-
- template <input_range _Range, weakly_incrementable _OutIter, class _Type, class _Proj = identity>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __val) -> bool { return __value == __val; };
- return ranges::__remove_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
- }
-};
-
-} // namespace __remove_copy
-
-inline namespace __cpo {
-inline constexpr auto remove_copy = __remove_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_remove_copy_if.h b/libcxx/include/__cxx03/__algorithm/ranges_remove_copy_if.h
deleted file mode 100644
index 3674e4c4207b7..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_remove_copy_if.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_IF_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/remove_copy_if.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using remove_copy_if_result = in_out_result<_InIter, _OutIter>;
-
-template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr in_out_result<_InIter, _OutIter>
-__remove_copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (!std::invoke(__pred, std::invoke(__proj, *__first))) {
- *__result = *__first;
- ++__result;
- }
- }
- return {std::move(__first), std::move(__result)};
-}
-
-namespace __remove_copy_if {
-
-struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
- }
-
- template <input_range _Range,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
- }
-};
-
-} // namespace __remove_copy_if
-
-inline namespace __cpo {
-inline constexpr auto remove_copy_if = __remove_copy_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_COPY_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_remove_if.h b/libcxx/include/__cxx03/__algorithm/ranges_remove_if.h
deleted file mode 100644
index 546acf8b78da3..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_remove_if.h
+++ /dev/null
@@ -1,89 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_IF_H
-#include <__cxx03/__config>
-
-#include <__cxx03/__algorithm/ranges_find_if.h>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Sent, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
-__remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
- auto __new_end = ranges::__find_if_impl(__first, __last, __pred, __proj);
- if (__new_end == __last)
- return {__new_end, __new_end};
-
- _Iter __i = __new_end;
- while (++__i != __last) {
- if (!std::invoke(__pred, std::invoke(__proj, *__i))) {
- *__new_end = ranges::iter_move(__i);
- ++__new_end;
- }
- }
- return {__new_end, __i};
-}
-
-namespace __remove_if {
-struct __fn {
- template <permutable _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj);
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires permutable<iterator_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-} // namespace __remove_if
-
-inline namespace __cpo {
-inline constexpr auto remove_if = __remove_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REMOVE_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_replace.h b/libcxx/include/__cxx03/__algorithm/ranges_replace.h
deleted file mode 100644
index f5c030e7993c2..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_replace.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_H
-
-#include <__cxx03/__algorithm/ranges_replace_if.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __replace {
-struct __fn {
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type1, class _Type2, class _Proj = identity>
- requires indirectly_writable<_Iter, const _Type2&> &&
- indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type1*>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(
- _Iter __first, _Sent __last, const _Type1& __old_value, const _Type2& __new_value, _Proj __proj = {}) const {
- auto __pred = [&](const auto& __val) -> bool { return __val == __old_value; };
- return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj);
- }
-
- template <input_range _Range, class _Type1, class _Type2, class _Proj = identity>
- requires indirectly_writable<iterator_t<_Range>, const _Type2&> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type1*>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, const _Type1& __old_value, const _Type2& __new_value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __val) -> bool { return __val == __old_value; };
- return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj);
- }
-};
-} // namespace __replace
-
-inline namespace __cpo {
-inline constexpr auto replace = __replace::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_replace_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_replace_copy.h
deleted file mode 100644
index 387b7a42f24c8..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_replace_copy.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/ranges_replace_copy_if.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using replace_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __replace_copy {
-
-struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- class _OldType,
- class _NewType,
- output_iterator<const _NewType&> _OutIter,
- class _Proj = identity>
- requires indirectly_copyable<_InIter, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _OldType*>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<_InIter, _OutIter>
- operator()(_InIter __first,
- _Sent __last,
- _OutIter __result,
- const _OldType& __old_value,
- const _NewType& __new_value,
- _Proj __proj = {}) const {
- auto __pred = [&](const auto& __value) -> bool { return __value == __old_value; };
- return ranges::__replace_copy_if_impl(
- std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
- }
-
- template <input_range _Range,
- class _OldType,
- class _NewType,
- output_iterator<const _NewType&> _OutIter,
- class _Proj = identity>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _OldType*>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(
- _Range&& __range, _OutIter __result, const _OldType& __old_value, const _NewType& __new_value, _Proj __proj = {})
- const {
- auto __pred = [&](const auto& __value) -> bool { return __value == __old_value; };
- return ranges::__replace_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
- }
-};
-
-} // namespace __replace_copy
-
-inline namespace __cpo {
-inline constexpr auto replace_copy = __replace_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_replace_copy_if.h b/libcxx/include/__cxx03/__algorithm/ranges_replace_copy_if.h
deleted file mode 100644
index f5786d9f8948d..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_replace_copy_if.h
+++ /dev/null
@@ -1,98 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_IF_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using replace_copy_if_result = in_out_result<_InIter, _OutIter>;
-
-template <class _InIter, class _Sent, class _OutIter, class _Pred, class _Type, class _Proj>
-_LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> __replace_copy_if_impl(
- _InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, const _Type& __new_value, _Proj& __proj) {
- while (__first != __last) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- *__result = __new_value;
- else
- *__result = *__first;
-
- ++__first;
- ++__result;
- }
-
- return {std::move(__first), std::move(__result)};
-}
-
-namespace __replace_copy_if {
-
-struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- class _Type,
- output_iterator<const _Type&> _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> operator()(
- _InIter __first, _Sent __last, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {})
- const {
- return ranges::__replace_copy_if_impl(
- std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
- }
-
- template <input_range _Range,
- class _Type,
- output_iterator<const _Type&> _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
- return ranges::__replace_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
- }
-};
-
-} // namespace __replace_copy_if
-
-inline namespace __cpo {
-inline constexpr auto replace_copy_if = __replace_copy_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_COPY_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_replace_if.h b/libcxx/include/__cxx03/__algorithm/ranges_replace_if.h
deleted file mode 100644
index 499cc7887b16c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_replace_if.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_IF_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_IF_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Iter, class _Sent, class _Type, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr _Iter
-__replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) {
- for (; __first != __last; ++__first) {
- if (std::invoke(__pred, std::invoke(__proj, *__first)))
- *__first = __new_value;
- }
- return __first;
-}
-
-namespace __replace_if {
-struct __fn {
- template <input_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Type,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- requires indirectly_writable<_Iter, const _Type&>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
- return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj);
- }
-
- template <input_range _Range,
- class _Type,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_writable<iterator_t<_Range>, const _Type&>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __range, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
- return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj);
- }
-};
-} // namespace __replace_if
-
-inline namespace __cpo {
-inline constexpr auto replace_if = __replace_if::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REPLACE_IF_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_reverse.h b/libcxx/include/__cxx03/__algorithm/ranges_reverse.h
deleted file mode 100644
index 577a4310f2152..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_reverse.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __reverse {
-struct __fn {
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent>
- requires permutable<_Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last) const {
- if constexpr (random_access_iterator<_Iter>) {
- if (__first == __last)
- return __first;
-
- auto __end = ranges::next(__first, __last);
- auto __ret = __end;
-
- while (__first < --__end) {
- ranges::iter_swap(__first, __end);
- ++__first;
- }
- return __ret;
- } else {
- auto __end = ranges::next(__first, __last);
- auto __ret = __end;
-
- while (__first != __end) {
- if (__first == --__end)
- break;
-
- ranges::iter_swap(__first, __end);
- ++__first;
- }
- return __ret;
- }
- }
-
- template <bidirectional_range _Range>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range) const {
- return (*this)(ranges::begin(__range), ranges::end(__range));
- }
-};
-} // namespace __reverse
-
-inline namespace __cpo {
-inline constexpr auto reverse = __reverse::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_reverse_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_reverse_copy.h
deleted file mode 100644
index d727202365b08..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_reverse_copy.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using reverse_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __reverse_copy {
-struct __fn {
- template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result) const {
- return (*this)(subrange(std::move(__first), std::move(__last)), std::move(__result));
- }
-
- template <bidirectional_range _Range, weakly_incrementable _OutIter>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result) const {
- auto __ret = ranges::copy(std::__reverse_range(__range), std::move(__result));
- return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)};
- }
-};
-} // namespace __reverse_copy
-
-inline namespace __cpo {
-inline constexpr auto reverse_copy = __reverse_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_REVERSE_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_rotate.h b/libcxx/include/__cxx03/__algorithm/ranges_rotate.h
deleted file mode 100644
index e6bef76b3cb74..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_rotate.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/ranges_iterator_concept.h>
-#include <__cxx03/__algorithm/rotate.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __rotate {
-
-struct __fn {
- template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> __rotate_fn_impl(_Iter __first, _Iter __middle, _Sent __last) {
- auto __ret = std::__rotate<_RangeAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <permutable _Iter, sentinel_for<_Iter> _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> operator()(_Iter __first, _Iter __middle, _Sent __last) const {
- return __rotate_fn_impl(std::move(__first), std::move(__middle), std::move(__last));
- }
-
- template <forward_range _Range>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, iterator_t<_Range> __middle) const {
- return __rotate_fn_impl(ranges::begin(__range), std::move(__middle), ranges::end(__range));
- }
-};
-
-} // namespace __rotate
-
-inline namespace __cpo {
-inline constexpr auto rotate = __rotate::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_rotate_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_rotate_copy.h
deleted file mode 100644
index 40975ad7213de..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_rotate_copy.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using rotate_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __rotate_copy {
-struct __fn {
- template <forward_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _InIter __middle, _Sent __last, _OutIter __result) const {
- auto __res1 = ranges::copy(__middle, __last, std::move(__result));
- auto __res2 = ranges::copy(__first, __middle, std::move(__res1.out));
- return {std::move(__res1.in), std::move(__res2.out)};
- }
-
- template <forward_range _Range, weakly_incrementable _OutIter>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, iterator_t<_Range> __middle, _OutIter __result) const {
- return (*this)(ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__result));
- }
-};
-} // namespace __rotate_copy
-
-inline namespace __cpo {
-inline constexpr auto rotate_copy = __rotate_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_ROTATE_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_sample.h b/libcxx/include/__cxx03/__algorithm/ranges_sample.h
deleted file mode 100644
index 778661c2ce413..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_sample.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SAMPLE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SAMPLE_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/sample.h>
-#include <__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__random/uniform_random_bit_generator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __sample {
-
-struct __fn {
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, weakly_incrementable _OutIter, class _Gen>
- requires(forward_iterator<_Iter> || random_access_iterator<_OutIter>) && indirectly_copyable<_Iter, _OutIter> &&
- uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI _OutIter
- operator()(_Iter __first, _Sent __last, _OutIter __out_first, iter_difference_t<_Iter> __n, _Gen&& __gen) const {
- _ClassicGenAdaptor<_Gen> __adapted_gen(__gen);
- return std::__sample<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__out_first), __n, __adapted_gen);
- }
-
- template <input_range _Range, weakly_incrementable _OutIter, class _Gen>
- requires(forward_range<_Range> || random_access_iterator<_OutIter>) &&
- indirectly_copyable<iterator_t<_Range>, _OutIter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI _OutIter
- operator()(_Range&& __range, _OutIter __out_first, range_difference_t<_Range> __n, _Gen&& __gen) const {
- return (*this)(
- ranges::begin(__range), ranges::end(__range), std::move(__out_first), __n, std::forward<_Gen>(__gen));
- }
-};
-
-} // namespace __sample
-
-inline namespace __cpo {
-inline constexpr auto sample = __sample::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SAMPLE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_search.h b/libcxx/include/__cxx03/__algorithm/ranges_search.h
deleted file mode 100644
index a4d56b80c9452..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_search.h
+++ /dev/null
@@ -1,134 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/search.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __search {
-struct __fn {
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
- _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_impl(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
- if constexpr (sized_sentinel_for<_Sent2, _Iter2>) {
- auto __size2 = ranges::distance(__first2, __last2);
- if (__size2 == 0)
- return {__first1, __first1};
-
- if constexpr (sized_sentinel_for<_Sent1, _Iter1>) {
- auto __size1 = ranges::distance(__first1, __last1);
- if (__size1 < __size2) {
- ranges::advance(__first1, __last1);
- return {__first1, __first1};
- }
-
- if constexpr (random_access_iterator<_Iter1> && random_access_iterator<_Iter2>) {
- auto __ret = std::__search_random_access_impl<_RangeAlgPolicy>(
- __first1, __last1, __first2, __last2, __pred, __proj1, __proj2, __size1, __size2);
- return {__ret.first, __ret.second};
- }
- }
- }
-
- auto __ret =
- std::__search_forward_impl<_RangeAlgPolicy>(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
- return {__ret.first, __ret.second};
- }
-
- template <forward_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter1> operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __ranges_search_impl(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
- }
-
- template <forward_range _Range1,
- forward_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range1> operator()(
- _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- auto __first1 = ranges::begin(__range1);
- if constexpr (sized_range<_Range2>) {
- auto __size2 = ranges::size(__range2);
- if (__size2 == 0)
- return {__first1, __first1};
- if constexpr (sized_range<_Range1>) {
- auto __size1 = ranges::size(__range1);
- if (__size1 < __size2) {
- ranges::advance(__first1, ranges::end(__range1));
- return {__first1, __first1};
- }
- }
- }
-
- return __ranges_search_impl(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
- }
-};
-} // namespace __search
-
-inline namespace __cpo {
-inline constexpr auto search = __search::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_search_n.h b/libcxx/include/__cxx03/__algorithm/ranges_search_n.h
deleted file mode 100644
index eac6e33a4da9e..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_search_n.h
+++ /dev/null
@@ -1,116 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_N_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_N_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/search_n.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __search_n {
-struct __fn {
- template <class _Iter1, class _Sent1, class _SizeT, class _Type, class _Pred, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_n_impl(
- _Iter1 __first, _Sent1 __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
- if (__count == 0)
- return {__first, __first};
-
- if constexpr (sized_sentinel_for<_Sent1, _Iter1>) {
- auto __size = ranges::distance(__first, __last);
- if (__size < __count) {
- ranges::advance(__first, __last);
- return {__first, __first};
- }
-
- if constexpr (random_access_iterator<_Iter1>) {
- auto __ret = std::__search_n_random_access_impl<_RangeAlgPolicy>(
- __first, __last, __count, __value, __pred, __proj, __size);
- return {std::move(__ret.first), std::move(__ret.second)};
- }
- }
-
- auto __ret = std::__search_n_forward_impl<_RangeAlgPolicy>(__first, __last, __count, __value, __pred, __proj);
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Type,
- class _Pred = ranges::equal_to,
- class _Proj = identity>
- requires indirectly_comparable<_Iter, const _Type*, _Pred, _Proj>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first,
- _Sent __last,
- iter_difference_t<_Iter> __count,
- const _Type& __value,
- _Pred __pred = {},
- _Proj __proj = _Proj{}) const {
- return __ranges_search_n_impl(__first, __last, __count, __value, __pred, __proj);
- }
-
- template <forward_range _Range, class _Type, class _Pred = ranges::equal_to, class _Proj = identity>
- requires indirectly_comparable<iterator_t<_Range>, const _Type*, _Pred, _Proj>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> operator()(
- _Range&& __range, range_difference_t<_Range> __count, const _Type& __value, _Pred __pred = {}, _Proj __proj = {})
- const {
- auto __first = ranges::begin(__range);
- if (__count <= 0)
- return {__first, __first};
- if constexpr (sized_range<_Range>) {
- auto __size1 = ranges::size(__range);
- if (__size1 < static_cast<range_size_t<_Range>>(__count)) {
- ranges::advance(__first, ranges::end(__range));
- return {__first, __first};
- }
- }
-
- return __ranges_search_n_impl(ranges::begin(__range), ranges::end(__range), __count, __value, __pred, __proj);
- }
-};
-} // namespace __search_n
-
-inline namespace __cpo {
-inline constexpr auto search_n = __search_n::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SEARCH_N_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_set_difference.h b/libcxx/include/__cxx03/__algorithm/ranges_set_difference.h
deleted file mode 100644
index 0343b68f8534d..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_set_difference.h
+++ /dev/null
@@ -1,109 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_DIFFERENCE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_DIFFERENCE_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/set_difference.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/mergeable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using set_difference_result = in_out_result<_InIter, _OutIter>;
-
-namespace __set_difference {
-
-struct __fn {
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_difference_result<_InIter1, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_difference<_RangeAlgPolicy>(
- __first1, __last1, __first2, __last2, __result, ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_difference_result<borrowed_iterator_t<_Range1>, _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_difference<_RangeAlgPolicy>(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __result,
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-
-} // namespace __set_difference
-
-inline namespace __cpo {
-inline constexpr auto set_difference = __set_difference::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SET_DIFFERENCE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_set_intersection.h b/libcxx/include/__cxx03/__algorithm/ranges_set_intersection.h
deleted file mode 100644
index ff0ae0fe1446f..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_set_intersection.h
+++ /dev/null
@@ -1,114 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H
-
-#include <__cxx03/__algorithm/in_in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/set_intersection.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/mergeable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2, class _OutIter>
-using set_intersection_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
-
-namespace __set_intersection {
-
-struct __fn {
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<_InIter1, _InIter2, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_intersection<_RangeAlgPolicy>(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<borrowed_iterator_t<_Range1>,
- borrowed_iterator_t<_Range2>,
- _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_intersection<_RangeAlgPolicy>(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-};
-
-} // namespace __set_intersection
-
-inline namespace __cpo {
-inline constexpr auto set_intersection = __set_intersection::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SET_INTERSECTION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_set_symmetric_difference.h b/libcxx/include/__cxx03/__algorithm/ranges_set_symmetric_difference.h
deleted file mode 100644
index 4c7413d5a656a..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_set_symmetric_difference.h
+++ /dev/null
@@ -1,114 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
-
-#include <__cxx03/__algorithm/in_in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/set_symmetric_difference.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/mergeable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2, class _OutIter>
-using set_symmetric_difference_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
-
-namespace __set_symmetric_difference {
-
-struct __fn {
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<_InIter1, _InIter2, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_symmetric_difference<_RangeAlgPolicy>(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_difference_result<borrowed_iterator_t<_Range1>,
- borrowed_iterator_t<_Range2>,
- _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_symmetric_difference<_RangeAlgPolicy>(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-};
-
-} // namespace __set_symmetric_difference
-
-inline namespace __cpo {
-inline constexpr auto set_symmetric_difference = __set_symmetric_difference::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_set_union.h b/libcxx/include/__cxx03/__algorithm/ranges_set_union.h
deleted file mode 100644
index 0752ee51d37d1..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_set_union.h
+++ /dev/null
@@ -1,115 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SET_UNION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SET_UNION_H
-
-#include <__cxx03/__algorithm/in_in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/set_union.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/mergeable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter1, class _InIter2, class _OutIter>
-using set_union_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
-
-namespace __set_union {
-
-struct __fn {
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<_InIter1, _InIter2, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_union<_RangeAlgPolicy>(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- auto __ret = std::__set_union<_RangeAlgPolicy>(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- std::move(__result),
- ranges::__make_projected_comp(__comp, __proj1, __proj2));
- return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
- }
-};
-
-} // namespace __set_union
-
-inline namespace __cpo {
-inline constexpr auto set_union = __set_union::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SET_UNION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_shuffle.h b/libcxx/include/__cxx03/__algorithm/ranges_shuffle.h
deleted file mode 100644
index 2728d5df97f58..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_shuffle.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SHUFFLE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SHUFFLE_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/shuffle.h>
-#include <__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__random/uniform_random_bit_generator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __shuffle {
-
-struct __fn {
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Gen>
- requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const {
- _ClassicGenAdaptor<_Gen> __adapted_gen(__gen);
- return std::__shuffle<_RangeAlgPolicy>(std::move(__first), std::move(__last), __adapted_gen);
- }
-
- template <random_access_range _Range, class _Gen>
- requires permutable<iterator_t<_Range>> && uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range> operator()(_Range&& __range, _Gen&& __gen) const {
- return (*this)(ranges::begin(__range), ranges::end(__range), std::forward<_Gen>(__gen));
- }
-};
-
-} // namespace __shuffle
-
-inline namespace __cpo {
-inline constexpr auto shuffle = __shuffle::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SHUFFLE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_sort.h b/libcxx/include/__cxx03/__algorithm/ranges_sort.h
deleted file mode 100644
index 4fa26ad238fa1..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_sort.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/sort.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __sort {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__sort_impl<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __sort_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __sort_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __sort
-
-inline namespace __cpo {
-inline constexpr auto sort = __sort::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_sort_heap.h b/libcxx/include/__cxx03/__algorithm/ranges_sort_heap.h
deleted file mode 100644
index 7c45fca156bae..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_sort_heap.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_HEAP_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_HEAP_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/sort_heap.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __sort_heap {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
- __sort_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__sort_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __sort_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __sort_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __sort_heap
-
-inline namespace __cpo {
-inline constexpr auto sort_heap = __sort_heap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SORT_HEAP_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_stable_partition.h b/libcxx/include/__cxx03/__algorithm/ranges_stable_partition.h
deleted file mode 100644
index b7d84dc6a0ccb..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_stable_partition.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_PARTITION_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_PARTITION_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/ranges_iterator_concept.h>
-#include <__cxx03/__algorithm/stable_partition.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __stable_partition {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static subrange<__remove_cvref_t<_Iter>>
- __stable_partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_pred = std::__make_projected(__pred, __proj);
- auto __result = std::__stable_partition<_RangeAlgPolicy>(
- std::move(__first), __last_iter, __projected_pred, __iterator_concept<_Iter>());
-
- return {std::move(__result), std::move(__last_iter)};
- }
-
- template <bidirectional_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- requires permutable<_Iter>
- _LIBCPP_HIDE_FROM_ABI subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
- return __stable_partition_fn_impl(__first, __last, __pred, __proj);
- }
-
- template <bidirectional_range _Range,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
- return __stable_partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
- }
-};
-
-} // namespace __stable_partition
-
-inline namespace __cpo {
-inline constexpr auto stable_partition = __stable_partition::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_PARTITION_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_stable_sort.h b/libcxx/include/__cxx03/__algorithm/ranges_stable_sort.h
deleted file mode 100644
index 83ff06971d081..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_stable_sort.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_SORT_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_SORT_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/stable_sort.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__iterator/sortable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __stable_sort {
-
-struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static _Iter __stable_sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
-
- auto&& __projected_comp = std::__make_projected(__comp, __proj);
- std::__stable_sort_impl<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp);
-
- return __last_iter;
- }
-
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __stable_sort_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
- }
-
- template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range>
- operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- return __stable_sort_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
- }
-};
-
-} // namespace __stable_sort
-
-inline namespace __cpo {
-inline constexpr auto stable_sort = __stable_sort::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_STABLE_SORT_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_starts_with.h b/libcxx/include/__cxx03/__algorithm/ranges_starts_with.h
deleted file mode 100644
index 91117ec29413f..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_starts_with.h
+++ /dev/null
@@ -1,95 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_STARTS_WITH_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_STARTS_WITH_H
-
-#include <__cxx03/__algorithm/in_in_result.h>
-#include <__cxx03/__algorithm/ranges_mismatch.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __starts_with {
-struct __fn {
- template <input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool operator()(
- _Iter1 __first1,
- _Sent1 __last1,
- _Iter2 __first2,
- _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) {
- return __mismatch::__fn::__go(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- __pred,
- __proj1,
- __proj2)
- .in2 == __last2;
- }
-
- template <input_range _Range1,
- input_range _Range2,
- class _Pred = ranges::equal_to,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool
- operator()(_Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) {
- return __mismatch::__fn::__go(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- __pred,
- __proj1,
- __proj2)
- .in2 == ranges::end(__range2);
- }
-};
-} // namespace __starts_with
-inline namespace __cpo {
-inline constexpr auto starts_with = __starts_with::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_STARTS_WITH_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_swap_ranges.h b/libcxx/include/__cxx03/__algorithm/ranges_swap_ranges.h
deleted file mode 100644
index 46a868f3a563f..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_swap_ranges.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_SWAP_RANGES_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_SWAP_RANGES_H
-
-#include <__cxx03/__algorithm/in_in_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/swap_ranges.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _I1, class _I2>
-using swap_ranges_result = in_in_result<_I1, _I2>;
-
-namespace __swap_ranges {
-struct __fn {
- template <input_iterator _I1, sentinel_for<_I1> _S1, input_iterator _I2, sentinel_for<_I2> _S2>
- requires indirectly_swappable<_I1, _I2>
- _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2>
- operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const {
- auto __ret = std::__swap_ranges<_RangeAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <input_range _R1, input_range _R2>
- requires indirectly_swappable<iterator_t<_R1>, iterator_t<_R2>>
- _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
- operator()(_R1&& __r1, _R2&& __r2) const {
- return operator()(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2));
- }
-};
-} // namespace __swap_ranges
-
-inline namespace __cpo {
-inline constexpr auto swap_ranges = __swap_ranges::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_SWAP_RANGES_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_transform.h b/libcxx/include/__cxx03/__algorithm/ranges_transform.h
deleted file mode 100644
index ba6ec5a3ea201..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_transform.h
+++ /dev/null
@@ -1,177 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_TRANSFORM_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_TRANSFORM_H
-
-#include <__cxx03/__algorithm/in_in_out_result.h>
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Ip, class _Op>
-using unary_transform_result = in_out_result<_Ip, _Op>;
-
-template <class _I1, class _I2, class _O1>
-using binary_transform_result = in_in_out_result<_I1, _I2, _O1>;
-
-namespace __transform {
-struct __fn {
-private:
- template <class _InIter, class _Sent, class _OutIter, class _Func, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr unary_transform_result<_InIter, _OutIter>
- __unary(_InIter __first, _Sent __last, _OutIter __result, _Func& __operation, _Proj& __projection) {
- while (__first != __last) {
- *__result = std::invoke(__operation, std::invoke(__projection, *__first));
- ++__first;
- ++__result;
- }
-
- return {std::move(__first), std::move(__result)};
- }
-
- template <class _InIter1,
- class _Sent1,
- class _InIter2,
- class _Sent2,
- class _OutIter,
- class _Func,
- class _Proj1,
- class _Proj2>
- _LIBCPP_HIDE_FROM_ABI static constexpr binary_transform_result<_InIter1, _InIter2, _OutIter>
- __binary(_InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Func& __binary_operation,
- _Proj1& __projection1,
- _Proj2& __projection2) {
- while (__first1 != __last1 && __first2 != __last2) {
- *__result =
- std::invoke(__binary_operation, std::invoke(__projection1, *__first1), std::invoke(__projection2, *__first2));
- ++__first1;
- ++__first2;
- ++__result;
- }
- return {std::move(__first1), std::move(__first2), std::move(__result)};
- }
-
-public:
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- copy_constructible _Func,
- class _Proj = identity>
- requires indirectly_writable<_OutIter, indirect_result_t<_Func&, projected<_InIter, _Proj>>>
- _LIBCPP_HIDE_FROM_ABI constexpr unary_transform_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, _Func __operation, _Proj __proj = {}) const {
- return __unary(std::move(__first), std::move(__last), std::move(__result), __operation, __proj);
- }
-
- template <input_range _Range, weakly_incrementable _OutIter, copy_constructible _Func, class _Proj = identity>
- requires indirectly_writable<_OutIter, indirect_result_t<_Func, projected<iterator_t<_Range>, _Proj>>>
- _LIBCPP_HIDE_FROM_ABI constexpr unary_transform_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Func __operation, _Proj __projection = {}) const {
- return __unary(ranges::begin(__range), ranges::end(__range), std::move(__result), __operation, __projection);
- }
-
- template <input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- copy_constructible _Func,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_writable<_OutIter,
- indirect_result_t<_Func&, projected<_InIter1, _Proj1>, projected<_InIter2, _Proj2>>>
- _LIBCPP_HIDE_FROM_ABI constexpr binary_transform_result<_InIter1, _InIter2, _OutIter> operator()(
- _InIter1 __first1,
- _Sent1 __last1,
- _InIter2 __first2,
- _Sent2 __last2,
- _OutIter __result,
- _Func __binary_operation,
- _Proj1 __projection1 = {},
- _Proj2 __projection2 = {}) const {
- return __binary(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__result),
- __binary_operation,
- __projection1,
- __projection2);
- }
-
- template <input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- copy_constructible _Func,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires indirectly_writable<
- _OutIter,
- indirect_result_t<_Func&, projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>>
- _LIBCPP_HIDE_FROM_ABI constexpr binary_transform_result<borrowed_iterator_t<_Range1>,
- borrowed_iterator_t<_Range2>,
- _OutIter>
- operator()(_Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Func __binary_operation,
- _Proj1 __projection1 = {},
- _Proj2 __projection2 = {}) const {
- return __binary(
- ranges::begin(__range1),
- ranges::end(__range1),
- ranges::begin(__range2),
- ranges::end(__range2),
- std::move(__result),
- __binary_operation,
- __projection1,
- __projection2);
- }
-};
-} // namespace __transform
-
-inline namespace __cpo {
-inline constexpr auto transform = __transform::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_TRANSFORM_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_unique.h b/libcxx/include/__cxx03/__algorithm/ranges_unique.h
deleted file mode 100644
index d54b1c5205c28..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_unique.h
+++ /dev/null
@@ -1,82 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/unique.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __unique {
-
-struct __fn {
- template <permutable _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_equivalence_relation<projected<_Iter, _Proj>> _Comp = ranges::equal_to>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret =
- std::__unique<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <forward_range _Range,
- class _Proj = identity,
- indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
- requires permutable<iterator_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__unique<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-
-} // namespace __unique
-
-inline namespace __cpo {
-inline constexpr auto unique = __unique::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_unique_copy.h b/libcxx/include/__cxx03/__algorithm/ranges_unique_copy.h
deleted file mode 100644
index 6eed79b258998..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_unique_copy.h
+++ /dev/null
@@ -1,120 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_COPY_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_COPY_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/make_projected.h>
-#include <__cxx03/__algorithm/unique_copy.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _InIter, class _OutIter>
-using unique_copy_result = in_out_result<_InIter, _OutIter>;
-
-namespace __unique_copy {
-
-template <class _InIter, class _OutIter>
-concept __can_reread_from_output = (input_iterator<_OutIter> && same_as<iter_value_t<_InIter>, iter_value_t<_OutIter>>);
-
-struct __fn {
- template <class _InIter, class _OutIter>
- static consteval auto __get_algo_tag() {
- if constexpr (forward_iterator<_InIter>) {
- return __unique_copy_tags::__reread_from_input_tag{};
- } else if constexpr (__can_reread_from_output<_InIter, _OutIter>) {
- return __unique_copy_tags::__reread_from_output_tag{};
- } else if constexpr (indirectly_copyable_storable<_InIter, _OutIter>) {
- return __unique_copy_tags::__read_from_tmp_value_tag{};
- }
- }
-
- template <class _InIter, class _OutIter>
- using __algo_tag_t = decltype(__get_algo_tag<_InIter, _OutIter>());
-
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_equivalence_relation<projected<_InIter, _Proj>> _Comp = ranges::equal_to>
- requires indirectly_copyable<_InIter, _OutIter> &&
- (forward_iterator<_InIter> ||
- (input_iterator<_OutIter> && same_as<iter_value_t<_InIter>, iter_value_t<_OutIter>>) ||
- indirectly_copyable_storable<_InIter, _OutIter>)
- _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__unique_copy<_RangeAlgPolicy>(
- std::move(__first),
- std::move(__last),
- std::move(__result),
- std::__make_projected(__comp, __proj),
- __algo_tag_t<_InIter, _OutIter>());
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-
- template <input_range _Range,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- (forward_iterator<iterator_t<_Range>> ||
- (input_iterator<_OutIter> && same_as<range_value_t<_Range>, iter_value_t<_OutIter>>) ||
- indirectly_copyable_storable<iterator_t<_Range>, _OutIter>)
- _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__unique_copy<_RangeAlgPolicy>(
- ranges::begin(__range),
- ranges::end(__range),
- std::move(__result),
- std::__make_projected(__comp, __proj),
- __algo_tag_t<iterator_t<_Range>, _OutIter>());
- return {std::move(__ret.first), std::move(__ret.second)};
- }
-};
-
-} // namespace __unique_copy
-
-inline namespace __cpo {
-inline constexpr auto unique_copy = __unique_copy::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_UNIQUE_COPY_H
diff --git a/libcxx/include/__cxx03/__algorithm/ranges_upper_bound.h b/libcxx/include/__cxx03/__algorithm/ranges_upper_bound.h
deleted file mode 100644
index 004b9ae654f85..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/ranges_upper_bound.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_RANGES_UPPER_BOUND_H
-#define _LIBCPP___CXX03___ALGORITHM_RANGES_UPPER_BOUND_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/lower_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-namespace __upper_bound {
-struct __fn {
- template <forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter
- operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) -> bool {
- return !std::invoke(__comp, __rhs, __lhs);
- };
-
- return std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp_lhs_rhs_swapped, __proj);
- }
-
- template <forward_range _Range,
- class _Type,
- class _Proj = identity,
- indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
- operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) -> bool {
- return !std::invoke(__comp, __rhs, __lhs);
- };
-
- return std::__lower_bound<_RangeAlgPolicy>(
- ranges::begin(__r), ranges::end(__r), __value, __comp_lhs_rhs_swapped, __proj);
- }
-};
-} // namespace __upper_bound
-
-inline namespace __cpo {
-inline constexpr auto upper_bound = __upper_bound::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___ALGORITHM_RANGES_UPPER_BOUND_H
diff --git a/libcxx/include/__cxx03/__algorithm/sample.h b/libcxx/include/__cxx03/__algorithm/sample.h
deleted file mode 100644
index 55e34c9f24813..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/sample.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_SAMPLE_H
-#define _LIBCPP___CXX03___ALGORITHM_SAMPLE_H
-
-#include <__cxx03/__algorithm/iterator_operations.h>
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__random/uniform_int_distribution.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _AlgPolicy,
- class _PopulationIterator,
- class _PopulationSentinel,
- class _SampleIterator,
- class _Distance,
- class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
- _PopulationIterator __first,
- _PopulationSentinel __last,
- _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- input_iterator_tag) {
- _Distance __k = 0;
- for (; __first != __last && __k < __n; ++__first, (void)++__k)
- __output_iter[__k] = *__first;
- _Distance __sz = __k;
- for (; __first != __last; ++__first, (void)++__k) {
- _Distance __r = uniform_int_distribution<_Distance>(0, __k)(__g);
- if (__r < __sz)
- __output_iter[__r] = *__first;
- }
- return __output_iter + std::min(__n, __k);
-}
-
-template <class _AlgPolicy,
- class _PopulationIterator,
- class _PopulationSentinel,
- class _SampleIterator,
- class _Distance,
- class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
- _PopulationIterator __first,
- _PopulationSentinel __last,
- _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g,
- forward_iterator_tag) {
- _Distance __unsampled_sz = _IterOps<_AlgPolicy>::distance(__first, __last);
- for (__n = std::min(__n, __unsampled_sz); __n != 0; ++__first) {
- _Distance __r = uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
- if (__r < __n) {
- *__output_iter++ = *__first;
- --__n;
- }
- }
- return __output_iter;
-}
-
-template <class _AlgPolicy,
- class _PopulationIterator,
- class _PopulationSentinel,
- class _SampleIterator,
- class _Distance,
- class _UniformRandomNumberGenerator>
-_LIBCPP_HIDE_FROM_ABI _SampleIterator __sample(
- _PopulationIterator __first,
- _PopulationSentinel __last,
- _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator& __g) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "N must be a positive number.");
-
- using _PopIterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_PopulationIterator>;
- using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>;
- using _CommonType = typename common_type<_Distance, _Difference>::type;
-
- return std::__sample<_AlgPolicy>(
- std::move(__first), std::move(__last), std::move(__output_iter), _CommonType(__n), __g, _PopIterCategory());
-}
-
-#if _LIBCPP_STD_VER >= 17
-template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator>
-inline _LIBCPP_HIDE_FROM_ABI _SampleIterator
-sample(_PopulationIterator __first,
- _PopulationIterator __last,
- _SampleIterator __output_iter,
- _Distance __n,
- _UniformRandomNumberGenerator&& __g) {
- static_assert(__has_forward_iterator_category<_PopulationIterator>::value ||
- __has_random_access_iterator_category<_SampleIterator>::value,
- "SampleIterator must meet the requirements of RandomAccessIterator");
-
- return std::__sample<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__output_iter), __n, __g);
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_SAMPLE_H
diff --git a/libcxx/include/__cxx03/__algorithm/search.h b/libcxx/include/__cxx03/__algorithm/search.h
index 7ca6bdbc2beb5..fd9aa0e4ffc77 100644
--- a/libcxx/include/__cxx03/__algorithm/search.h
+++ b/libcxx/include/__cxx03/__algorithm/search.h
@@ -14,11 +14,10 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/enable_if.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/pair.h>
diff --git a/libcxx/include/__cxx03/__algorithm/search_n.h b/libcxx/include/__cxx03/__algorithm/search_n.h
index cf63de27666b2..6fb5d52d4ff30 100644
--- a/libcxx/include/__cxx03/__algorithm/search_n.h
+++ b/libcxx/include/__cxx03/__algorithm/search_n.h
@@ -14,12 +14,10 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/concepts.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_callable.h>
#include <__cxx03/__utility/convert_to_integral.h>
#include <__cxx03/__utility/pair.h>
diff --git a/libcxx/include/__cxx03/__algorithm/set_difference.h b/libcxx/include/__cxx03/__algorithm/set_difference.h
index 1bdddd3955980..4092e6753e5f6 100644
--- a/libcxx/include/__cxx03/__algorithm/set_difference.h
+++ b/libcxx/include/__cxx03/__algorithm/set_difference.h
@@ -15,7 +15,6 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/remove_cvref.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/set_intersection.h b/libcxx/include/__cxx03/__algorithm/set_intersection.h
index 8164ced338d20..4e02d3e9c51c7 100644
--- a/libcxx/include/__cxx03/__algorithm/set_intersection.h
+++ b/libcxx/include/__cxx03/__algorithm/set_intersection.h
@@ -18,7 +18,6 @@
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/exchange.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/__utility/swap.h>
diff --git a/libcxx/include/__cxx03/__algorithm/shift_left.h b/libcxx/include/__cxx03/__algorithm/shift_left.h
deleted file mode 100644
index 886f353f2814c..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/shift_left.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_SHIFT_LEFT_H
-#define _LIBCPP___CXX03___ALGORITHM_SHIFT_LEFT_H
-
-#include <__cxx03/__algorithm/move.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/iterator_traits.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
-shift_left(_ForwardIterator __first,
- _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n) {
- if (__n == 0) {
- return __last;
- }
-
- _ForwardIterator __m = __first;
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- if (__n >= __last - __first) {
- return __first;
- }
- __m += __n;
- } else {
- for (; __n > 0; --__n) {
- if (__m == __last) {
- return __first;
- }
- ++__m;
- }
- }
- return std::move(__m, __last, __first);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_SHIFT_LEFT_H
diff --git a/libcxx/include/__cxx03/__algorithm/shift_right.h b/libcxx/include/__cxx03/__algorithm/shift_right.h
deleted file mode 100644
index 4bff76af2fd99..0000000000000
--- a/libcxx/include/__cxx03/__algorithm/shift_right.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ALGORITHM_SHIFT_RIGHT_H
-#define _LIBCPP___CXX03___ALGORITHM_SHIFT_RIGHT_H
-
-#include <__cxx03/__algorithm/move.h>
-#include <__cxx03/__algorithm/move_backward.h>
-#include <__cxx03/__algorithm/swap_ranges.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__utility/swap.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _ForwardIterator>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
-shift_right(_ForwardIterator __first,
- _ForwardIterator __last,
- typename iterator_traits<_ForwardIterator>::difference_type __n) {
- if (__n == 0) {
- return __first;
- }
-
- if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
- decltype(__n) __d = __last - __first;
- if (__n >= __d) {
- return __last;
- }
- _ForwardIterator __m = __first + (__d - __n);
- return std::move_backward(__first, __m, __last);
- } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
- _ForwardIterator __m = __last;
- for (; __n > 0; --__n) {
- if (__m == __first) {
- return __last;
- }
- --__m;
- }
- return std::move_backward(__first, __m, __last);
- } else {
- _ForwardIterator __ret = __first;
- for (; __n > 0; --__n) {
- if (__ret == __last) {
- return __last;
- }
- ++__ret;
- }
-
- // We have an __n-element scratch space from __first to __ret.
- // Slide an __n-element window [__trail, __lead) from left to right.
- // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
- // over and over; but once __lead reaches __last we needn't bother
- // to save the values of elements [__trail, __last).
-
- auto __trail = __first;
- auto __lead = __ret;
- while (__trail != __ret) {
- if (__lead == __last) {
- std::move(__first, __trail, __ret);
- return __ret;
- }
- ++__trail;
- ++__lead;
- }
-
- _ForwardIterator __mid = __first;
- while (true) {
- if (__lead == __last) {
- __trail = std::move(__mid, __ret, __trail);
- std::move(__first, __mid, __trail);
- return __ret;
- }
- swap(*__mid, *__trail);
- ++__mid;
- ++__trail;
- ++__lead;
- if (__mid == __ret) {
- __mid = __first;
- }
- }
- }
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ALGORITHM_SHIFT_RIGHT_H
diff --git a/libcxx/include/__cxx03/__algorithm/simd_utils.h b/libcxx/include/__cxx03/__algorithm/simd_utils.h
index db2e20fb65ece..1cd6ae2893672 100644
--- a/libcxx/include/__cxx03/__algorithm/simd_utils.h
+++ b/libcxx/include/__cxx03/__algorithm/simd_utils.h
@@ -10,7 +10,6 @@
#define _LIBCPP___CXX03___ALGORITHM_SIMD_UTILS_H
#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__bit/bit_cast.h>
#include <__cxx03/__bit/countl.h>
#include <__cxx03/__bit/countr.h>
#include <__cxx03/__config>
diff --git a/libcxx/include/__cxx03/__algorithm/sort.h b/libcxx/include/__cxx03/__algorithm/sort.h
index 009ebf717bbd8..f0f1babe731ed 100644
--- a/libcxx/include/__cxx03/__algorithm/sort.h
+++ b/libcxx/include/__cxx03/__algorithm/sort.h
@@ -24,7 +24,6 @@
#include <__cxx03/__debug_utils/randomize_range.h>
#include <__cxx03/__debug_utils/strict_weak_ordering_check.h>
#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__functional/ranges_operations.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/disjunction.h>
diff --git a/libcxx/include/__cxx03/__algorithm/unwrap_range.h b/libcxx/include/__cxx03/__algorithm/unwrap_range.h
index 0b81f1e805c8a..144f57b44b445 100644
--- a/libcxx/include/__cxx03/__algorithm/unwrap_range.h
+++ b/libcxx/include/__cxx03/__algorithm/unwrap_range.h
@@ -10,9 +10,7 @@
#define _LIBCPP___CXX03___ALGORITHM_UNWRAP_RANGE_H
#include <__cxx03/__algorithm/unwrap_iter.h>
-#include <__cxx03/__concepts/constructible.h>
#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
#include <__cxx03/__iterator/next.h>
#include <__cxx03/__utility/declval.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__algorithm/upper_bound.h b/libcxx/include/__cxx03/__algorithm/upper_bound.h
index 3a0f1f560cb77..d01780291c6e5 100644
--- a/libcxx/include/__cxx03/__algorithm/upper_bound.h
+++ b/libcxx/include/__cxx03/__algorithm/upper_bound.h
@@ -14,10 +14,10 @@
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/advance.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_constructible.h>
#include <__cxx03/__utility/move.h>
diff --git a/libcxx/include/__cxx03/__atomic/atomic_ref.h b/libcxx/include/__cxx03/__atomic/atomic_ref.h
deleted file mode 100644
index f30aac3210e27..0000000000000
--- a/libcxx/include/__cxx03/__atomic/atomic_ref.h
+++ /dev/null
@@ -1,378 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ATOMIC_ATOMIC_REF_H
-#define _LIBCPP___CXX03___ATOMIC_ATOMIC_REF_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__atomic/atomic_sync.h>
-#include <__cxx03/__atomic/check_memory_order.h>
-#include <__cxx03/__atomic/to_gcc_order.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/has_unique_object_representation.h>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-#include <__cxx03/cstring>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// These types are required to make __atomic_is_always_lock_free work across GCC and Clang.
-// The purpose of this trick is to make sure that we provide an object with the correct alignment
-// to __atomic_is_always_lock_free, since that answer depends on the alignment.
-template <size_t _Alignment>
-struct __alignment_checker_type {
- alignas(_Alignment) char __data;
-};
-
-template <size_t _Alignment>
-struct __get_aligner_instance {
- static constexpr __alignment_checker_type<_Alignment> __instance{};
-};
-
-template <class _Tp>
-struct __atomic_ref_base {
-private:
- _LIBCPP_HIDE_FROM_ABI static _Tp* __clear_padding(_Tp& __val) noexcept {
- _Tp* __ptr = std::addressof(__val);
-# if __has_builtin(__builtin_clear_padding)
- __builtin_clear_padding(__ptr);
-# endif
- return __ptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static bool __compare_exchange(
- _Tp* __ptr, _Tp* __expected, _Tp* __desired, bool __is_weak, int __success, int __failure) noexcept {
- if constexpr (
-# if __has_builtin(__builtin_clear_padding)
- has_unique_object_representations_v<_Tp> || floating_point<_Tp>
-# else
- true // NOLINT(readability-simplify-boolean-expr)
-# endif
- ) {
- return __atomic_compare_exchange(__ptr, __expected, __desired, __is_weak, __success, __failure);
- } else { // _Tp has padding bits and __builtin_clear_padding is available
- __clear_padding(*__desired);
- _Tp __copy = *__expected;
- __clear_padding(__copy);
- // The algorithm we use here is basically to perform `__atomic_compare_exchange` on the
- // values until it has either succeeded, or failed because the value representation of the
- // objects involved was different. This is why we loop around __atomic_compare_exchange:
- // we basically loop until its failure is caused by the value representation of the objects
- // being different, not only their object representation.
- while (true) {
- _Tp __prev = __copy;
- if (__atomic_compare_exchange(__ptr, std::addressof(__copy), __desired, __is_weak, __success, __failure)) {
- return true;
- }
- _Tp __curr = __copy;
- if (std::memcmp(__clear_padding(__prev), __clear_padding(__curr), sizeof(_Tp)) != 0) {
- // Value representation without padding bits do not compare equal ->
- // write the current content of *ptr into *expected
- std::memcpy(__expected, std::addressof(__copy), sizeof(_Tp));
- return false;
- }
- }
- }
- }
-
- friend struct __atomic_waitable_traits<__atomic_ref_base<_Tp>>;
-
- // require types that are 1, 2, 4, 8, or 16 bytes in length to be aligned to at least their size to be potentially
- // used lock-free
- static constexpr size_t __min_alignment = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || (sizeof(_Tp) > 16) ? 0 : sizeof(_Tp);
-
-public:
- using value_type = _Tp;
-
- static constexpr size_t required_alignment = alignof(_Tp) > __min_alignment ? alignof(_Tp) : __min_alignment;
-
- // The __atomic_always_lock_free builtin takes into account the alignment of the pointer if provided,
- // so we create a fake pointer with a suitable alignment when querying it. Note that we are guaranteed
- // that the pointer is going to be aligned properly at runtime because that is a (checked) precondition
- // of atomic_ref's constructor.
- static constexpr bool is_always_lock_free =
- __atomic_always_lock_free(sizeof(_Tp), &__get_aligner_instance<required_alignment>::__instance);
-
- _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(_Tp), __ptr_); }
-
- _LIBCPP_HIDE_FROM_ABI void store(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept
- _LIBCPP_CHECK_STORE_MEMORY_ORDER(__order) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __order == memory_order::relaxed || __order == memory_order::release || __order == memory_order::seq_cst,
- "atomic_ref: memory order argument to atomic store operation is invalid");
- __atomic_store(__ptr_, __clear_padding(__desired), std::__to_gcc_order(__order));
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept {
- store(__desired);
- return __desired;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __order = memory_order::seq_cst) const noexcept
- _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__order) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __order == memory_order::relaxed || __order == memory_order::consume || __order == memory_order::acquire ||
- __order == memory_order::seq_cst,
- "atomic_ref: memory order argument to atomic load operation is invalid");
- alignas(_Tp) byte __mem[sizeof(_Tp)];
- auto* __ret = reinterpret_cast<_Tp*>(__mem);
- __atomic_load(__ptr_, __ret, std::__to_gcc_order(__order));
- return *__ret;
- }
-
- _LIBCPP_HIDE_FROM_ABI operator _Tp() const noexcept { return load(); }
-
- _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
- alignas(_Tp) byte __mem[sizeof(_Tp)];
- auto* __ret = reinterpret_cast<_Tp*>(__mem);
- __atomic_exchange(__ptr_, __clear_padding(__desired), __ret, std::__to_gcc_order(__order));
- return *__ret;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __expected, _Tp __desired, memory_order __success, memory_order __failure) const noexcept
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__success, __failure) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __failure == memory_order::relaxed || __failure == memory_order::consume ||
- __failure == memory_order::acquire || __failure == memory_order::seq_cst,
- "atomic_ref: failure memory order argument to weak atomic compare-and-exchange operation is invalid");
- return __compare_exchange(
- __ptr_,
- std::addressof(__expected),
- std::addressof(__desired),
- true,
- std::__to_gcc_order(__success),
- std::__to_gcc_order(__failure));
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __expected, _Tp __desired, memory_order __success, memory_order __failure) const noexcept
- _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__success, __failure) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __failure == memory_order::relaxed || __failure == memory_order::consume ||
- __failure == memory_order::acquire || __failure == memory_order::seq_cst,
- "atomic_ref: failure memory order argument to strong atomic compare-and-exchange operation is invalid");
- return __compare_exchange(
- __ptr_,
- std::addressof(__expected),
- std::addressof(__desired),
- false,
- std::__to_gcc_order(__success),
- std::__to_gcc_order(__failure));
- }
-
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_weak(_Tp& __expected, _Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
- return __compare_exchange(
- __ptr_,
- std::addressof(__expected),
- std::addressof(__desired),
- true,
- std::__to_gcc_order(__order),
- std::__to_gcc_failure_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI bool
- compare_exchange_strong(_Tp& __expected, _Tp __desired, memory_order __order = memory_order::seq_cst) const noexcept {
- return __compare_exchange(
- __ptr_,
- std::addressof(__expected),
- std::addressof(__desired),
- false,
- std::__to_gcc_order(__order),
- std::__to_gcc_failure_order(__order));
- }
-
- _LIBCPP_HIDE_FROM_ABI void wait(_Tp __old, memory_order __order = memory_order::seq_cst) const noexcept
- _LIBCPP_CHECK_WAIT_MEMORY_ORDER(__order) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __order == memory_order::relaxed || __order == memory_order::consume || __order == memory_order::acquire ||
- __order == memory_order::seq_cst,
- "atomic_ref: memory order argument to atomic wait operation is invalid");
- std::__atomic_wait(*this, __old, __order);
- }
- _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); }
- _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); }
-
-protected:
- typedef _Tp _Aligned_Tp __attribute__((aligned(required_alignment)));
- _Aligned_Tp* __ptr_;
-
- _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {}
-};
-
-template <class _Tp>
-struct __atomic_waitable_traits<__atomic_ref_base<_Tp>> {
- static _LIBCPP_HIDE_FROM_ABI _Tp __atomic_load(const __atomic_ref_base<_Tp>& __a, memory_order __order) {
- return __a.load(__order);
- }
- static _LIBCPP_HIDE_FROM_ABI const _Tp* __atomic_contention_address(const __atomic_ref_base<_Tp>& __a) {
- return __a.__ptr_;
- }
-};
-
-template <class _Tp>
-struct atomic_ref : public __atomic_ref_base<_Tp> {
- static_assert(is_trivially_copyable_v<_Tp>, "std::atomic_ref<T> requires that 'T' be a trivially copyable type");
-
- using __base = __atomic_ref_base<_Tp>;
-
- _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
- "atomic_ref ctor: referenced object must be aligned to required_alignment");
- }
-
- _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
-
- atomic_ref& operator=(const atomic_ref&) = delete;
-};
-
-template <class _Tp>
- requires(std::integral<_Tp> && !std::same_as<bool, _Tp>)
-struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
- using __base = __atomic_ref_base<_Tp>;
-
- using difference_type = __base::value_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
- "atomic_ref ctor: referenced object must be aligned to required_alignment");
- }
-
- _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
-
- atomic_ref& operator=(const atomic_ref&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_add(this->__ptr_, __arg, std::__to_gcc_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_sub(this->__ptr_, __arg, std::__to_gcc_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_and(this->__ptr_, __arg, std::__to_gcc_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_or(this->__ptr_, __arg, std::__to_gcc_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_xor(this->__ptr_, __arg, std::__to_gcc_order(__order));
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator++(int) const noexcept { return fetch_add(_Tp(1)); }
- _LIBCPP_HIDE_FROM_ABI _Tp operator--(int) const noexcept { return fetch_sub(_Tp(1)); }
- _LIBCPP_HIDE_FROM_ABI _Tp operator++() const noexcept { return fetch_add(_Tp(1)) + _Tp(1); }
- _LIBCPP_HIDE_FROM_ABI _Tp operator--() const noexcept { return fetch_sub(_Tp(1)) - _Tp(1); }
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp operator&=(_Tp __arg) const noexcept { return fetch_and(__arg) & __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp operator|=(_Tp __arg) const noexcept { return fetch_or(__arg) | __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp operator^=(_Tp __arg) const noexcept { return fetch_xor(__arg) ^ __arg; }
-};
-
-template <class _Tp>
- requires std::floating_point<_Tp>
-struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
- using __base = __atomic_ref_base<_Tp>;
-
- using difference_type = __base::value_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
- "atomic_ref ctor: referenced object must be aligned to required_alignment");
- }
-
- _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
-
- atomic_ref& operator=(const atomic_ref&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- _Tp __old = this->load(memory_order_relaxed);
- _Tp __new = __old + __arg;
- while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
- __new = __old + __arg;
- }
- return __old;
- }
- _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- _Tp __old = this->load(memory_order_relaxed);
- _Tp __new = __old - __arg;
- while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed)) {
- __new = __old - __arg;
- }
- return __old;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __arg) const noexcept { return fetch_sub(__arg) - __arg; }
-};
-
-template <class _Tp>
-struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
- using __base = __atomic_ref_base<_Tp*>;
-
- using difference_type = ptrdiff_t;
-
- _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {}
-
- _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); }
-
- atomic_ref& operator=(const atomic_ref&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI _Tp* fetch_add(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_add(this->__ptr_, __arg * sizeof(_Tp), std::__to_gcc_order(__order));
- }
- _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __arg, memory_order __order = memory_order_seq_cst) const noexcept {
- return __atomic_fetch_sub(this->__ptr_, __arg * sizeof(_Tp), std::__to_gcc_order(__order));
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) const noexcept { return fetch_add(1); }
- _LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) const noexcept { return fetch_sub(1); }
- _LIBCPP_HIDE_FROM_ABI _Tp* operator++() const noexcept { return fetch_add(1) + 1; }
- _LIBCPP_HIDE_FROM_ABI _Tp* operator--() const noexcept { return fetch_sub(1) - 1; }
- _LIBCPP_HIDE_FROM_ABI _Tp* operator+=(ptrdiff_t __arg) const noexcept { return fetch_add(__arg) + __arg; }
- _LIBCPP_HIDE_FROM_ABI _Tp* operator-=(ptrdiff_t __arg) const noexcept { return fetch_sub(__arg) - __arg; }
-};
-
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(atomic_ref);
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03__ATOMIC_ATOMIC_REF_H
diff --git a/libcxx/include/__cxx03/__bit/bit_cast.h b/libcxx/include/__cxx03/__bit/bit_cast.h
deleted file mode 100644
index 2613dc4aa332a..0000000000000
--- a/libcxx/include/__cxx03/__bit/bit_cast.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___BIT_BIT_CAST_H
-#define _LIBCPP___CXX03___BIT_BIT_CAST_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _ToType, class _FromType>
-_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept {
- return __builtin_bit_cast(_ToType, __from);
-}
-
-#endif // _LIBCPP_CXX03_LANG
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _ToType, class _FromType>
- requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> &&
- is_trivially_copyable_v<_FromType>)
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _ToType bit_cast(const _FromType& __from) noexcept {
- return __builtin_bit_cast(_ToType, __from);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___BIT_BIT_CAST_H
diff --git a/libcxx/include/__cxx03/__bit/bit_ceil.h b/libcxx/include/__cxx03/__bit/bit_ceil.h
deleted file mode 100644
index 598344b1d4268..0000000000000
--- a/libcxx/include/__cxx03/__bit/bit_ceil.h
+++ /dev/null
@@ -1,54 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_BIT_CEIL_H
-#define _LIBCPP___CXX03___BIT_BIT_CEIL_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) noexcept {
- if (__t < 2)
- return 1;
- const unsigned __n = numeric_limits<_Tp>::digits - std::__countl_zero((_Tp)(__t - 1u));
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil");
-
- if constexpr (sizeof(_Tp) >= sizeof(unsigned))
- return _Tp{1} << __n;
- else {
- const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits;
- const unsigned __ret_val = 1u << (__n + __extra);
- return (_Tp)(__ret_val >> __extra);
- }
-}
-
-# if _LIBCPP_STD_VER >= 20
-
-template <__libcpp_unsigned_integer _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noexcept {
- return std::__bit_ceil(__t);
-}
-
-# endif // _LIBCPP_STD_VER >= 20
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___BIT_BIT_CEIL_H
diff --git a/libcxx/include/__cxx03/__bit/bit_floor.h b/libcxx/include/__cxx03/__bit/bit_floor.h
deleted file mode 100644
index b39d73a64e078..0000000000000
--- a/libcxx/include/__cxx03/__bit/bit_floor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_BIT_FLOOR_H
-#define _LIBCPP___CXX03___BIT_BIT_FLOOR_H
-
-#include <__cxx03/__bit/bit_log2.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__libcpp_unsigned_integer _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_floor(_Tp __t) noexcept {
- return __t == 0 ? 0 : _Tp{1} << std::__bit_log2(__t);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___BIT_BIT_FLOOR_H
diff --git a/libcxx/include/__cxx03/__bit/bit_log2.h b/libcxx/include/__cxx03/__bit/bit_log2.h
deleted file mode 100644
index 1ca80959e6dac..0000000000000
--- a/libcxx/include/__cxx03/__bit/bit_log2.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_BIT_LOG2_H
-#define _LIBCPP___CXX03___BIT_BIT_LOG2_H
-
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__libcpp_unsigned_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_log2(_Tp __t) noexcept {
- return numeric_limits<_Tp>::digits - 1 - std::countl_zero(__t);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___BIT_BIT_LOG2_H
diff --git a/libcxx/include/__cxx03/__bit/bit_width.h b/libcxx/include/__cxx03/__bit/bit_width.h
deleted file mode 100644
index e5d9ffd03ca7f..0000000000000
--- a/libcxx/include/__cxx03/__bit/bit_width.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_BIT_WIDTH_H
-#define _LIBCPP___CXX03___BIT_BIT_WIDTH_H
-
-#include <__cxx03/__bit/bit_log2.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <__libcpp_unsigned_integer _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int bit_width(_Tp __t) noexcept {
- return __t == 0 ? 0 : std::__bit_log2(__t) + 1;
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___BIT_BIT_WIDTH_H
diff --git a/libcxx/include/__cxx03/__bit/byteswap.h b/libcxx/include/__cxx03/__bit/byteswap.h
deleted file mode 100644
index f40d870ca7fc2..0000000000000
--- a/libcxx/include/__cxx03/__bit/byteswap.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___BIT_BYTESWAP_H
-#define _LIBCPP___CXX03___BIT_BYTESWAP_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <integral _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
- if constexpr (sizeof(_Tp) == 1) {
- return __val;
- } else if constexpr (sizeof(_Tp) == 2) {
- return __builtin_bswap16(__val);
- } else if constexpr (sizeof(_Tp) == 4) {
- return __builtin_bswap32(__val);
- } else if constexpr (sizeof(_Tp) == 8) {
- return __builtin_bswap64(__val);
-# ifndef _LIBCPP_HAS_NO_INT128
- } else if constexpr (sizeof(_Tp) == 16) {
-# if __has_builtin(__builtin_bswap128)
- return __builtin_bswap128(__val);
-# else
- return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
- static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
-# endif // __has_builtin(__builtin_bswap128)
-# endif // _LIBCPP_HAS_NO_INT128
- } else {
- static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
- }
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___BIT_BYTESWAP_H
diff --git a/libcxx/include/__cxx03/__bit/countl.h b/libcxx/include/__cxx03/__bit/countl.h
index 0c8181b53408c..e67fc4cacaacf 100644
--- a/libcxx/include/__cxx03/__bit/countl.h
+++ b/libcxx/include/__cxx03/__bit/countl.h
@@ -13,7 +13,6 @@
#define _LIBCPP___CXX03___BIT_COUNTL_H
#include <__cxx03/__bit/rotate.h>
-#include <__cxx03/__concepts/arithmetic.h>
#include <__cxx03/__config>
#include <__cxx03/__type_traits/is_unsigned_integer.h>
#include <__cxx03/limits>
diff --git a/libcxx/include/__cxx03/__bit/countr.h b/libcxx/include/__cxx03/__bit/countr.h
index d9306a234cb30..3fed2dd410329 100644
--- a/libcxx/include/__cxx03/__bit/countr.h
+++ b/libcxx/include/__cxx03/__bit/countr.h
@@ -13,7 +13,6 @@
#define _LIBCPP___CXX03___BIT_COUNTR_H
#include <__cxx03/__bit/rotate.h>
-#include <__cxx03/__concepts/arithmetic.h>
#include <__cxx03/__config>
#include <__cxx03/limits>
diff --git a/libcxx/include/__cxx03/__bit/endian.h b/libcxx/include/__cxx03/__bit/endian.h
deleted file mode 100644
index 641f827736b4f..0000000000000
--- a/libcxx/include/__cxx03/__bit/endian.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_ENDIAN_H
-#define _LIBCPP___CXX03___BIT_ENDIAN_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-enum class endian {
- little = 0xDEAD,
- big = 0xFACE,
-# if defined(_LIBCPP_LITTLE_ENDIAN)
- native = little
-# elif defined(_LIBCPP_BIG_ENDIAN)
- native = big
-# else
- native = 0xCAFE
-# endif
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___BIT_ENDIAN_H
diff --git a/libcxx/include/__cxx03/__bit/has_single_bit.h b/libcxx/include/__cxx03/__bit/has_single_bit.h
deleted file mode 100644
index 07f3f8523d585..0000000000000
--- a/libcxx/include/__cxx03/__bit/has_single_bit.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___BIT_HAS_SINGLE_BIT_H
-#define _LIBCPP___CXX03___BIT_HAS_SINGLE_BIT_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <__libcpp_unsigned_integer _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_single_bit(_Tp __t) noexcept {
- return __t != 0 && (((__t & (__t - 1)) == 0));
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___BIT_HAS_SINGLE_BIT_H
diff --git a/libcxx/include/__cxx03/__bit/invert_if.h b/libcxx/include/__cxx03/__bit/invert_if.h
index b111d702ea755..270bd55a59e96 100644
--- a/libcxx/include/__cxx03/__bit/invert_if.h
+++ b/libcxx/include/__cxx03/__bit/invert_if.h
@@ -9,7 +9,6 @@
#ifndef _LIBCPP___CXX03___BIT_INVERT_IF_H
#define _LIBCPP___CXX03___BIT_INVERT_IF_H
-#include <__cxx03/__concepts/arithmetic.h>
#include <__cxx03/__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__bit/popcount.h b/libcxx/include/__cxx03/__bit/popcount.h
index 835c07703f233..59a6a7242708f 100644
--- a/libcxx/include/__cxx03/__bit/popcount.h
+++ b/libcxx/include/__cxx03/__bit/popcount.h
@@ -13,7 +13,6 @@
#define _LIBCPP___CXX03___BIT_POPCOUNT_H
#include <__cxx03/__bit/rotate.h>
-#include <__cxx03/__concepts/arithmetic.h>
#include <__cxx03/__config>
#include <__cxx03/limits>
diff --git a/libcxx/include/__cxx03/__bit/rotate.h b/libcxx/include/__cxx03/__bit/rotate.h
index 0ce3d2c7629db..d39d6ee090715 100644
--- a/libcxx/include/__cxx03/__bit/rotate.h
+++ b/libcxx/include/__cxx03/__bit/rotate.h
@@ -9,7 +9,6 @@
#ifndef _LIBCPP___CXX03___BIT_ROTATE_H
#define _LIBCPP___CXX03___BIT_ROTATE_H
-#include <__cxx03/__concepts/arithmetic.h>
#include <__cxx03/__config>
#include <__cxx03/__type_traits/is_unsigned_integer.h>
#include <__cxx03/limits>
diff --git a/libcxx/include/__cxx03/__bit_reference b/libcxx/include/__cxx03/__bit_reference
index bf86f9a76e24a..d4e01111eb0fe 100644
--- a/libcxx/include/__cxx03/__bit_reference
+++ b/libcxx/include/__cxx03/__bit_reference
@@ -16,7 +16,6 @@
#include <__cxx03/__bit/countr.h>
#include <__cxx03/__bit/invert_if.h>
#include <__cxx03/__bit/popcount.h>
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__fwd/bit_reference.h>
#include <__cxx03/__iterator/iterator_traits.h>
diff --git a/libcxx/include/__cxx03/__charconv/chars_format.h b/libcxx/include/__cxx03/__charconv/chars_format.h
deleted file mode 100644
index a886521832eff..0000000000000
--- a/libcxx/include/__cxx03/__charconv/chars_format.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_CHARS_FORMAT_H
-#define _LIBCPP___CXX03___CHARCONV_CHARS_FORMAT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__utility/to_underlying.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-enum class chars_format { scientific = 0x1, fixed = 0x2, hex = 0x4, general = fixed | scientific };
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator~(chars_format __x) {
- return chars_format(~std::__to_underlying(__x));
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator&(chars_format __x, chars_format __y) {
- return chars_format(std::__to_underlying(__x) & std::__to_underlying(__y));
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator|(chars_format __x, chars_format __y) {
- return chars_format(std::__to_underlying(__x) | std::__to_underlying(__y));
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator^(chars_format __x, chars_format __y) {
- return chars_format(std::__to_underlying(__x) ^ std::__to_underlying(__y));
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator&=(chars_format& __x, chars_format __y) {
- __x = __x & __y;
- return __x;
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator|=(chars_format& __x, chars_format __y) {
- __x = __x | __y;
- return __x;
-}
-
-inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator^=(chars_format& __x, chars_format __y) {
- __x = __x ^ __y;
- return __x;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_CHARS_FORMAT_H
diff --git a/libcxx/include/__cxx03/__charconv/from_chars_integral.h b/libcxx/include/__cxx03/__charconv/from_chars_integral.h
deleted file mode 100644
index ba3746fcf776e..0000000000000
--- a/libcxx/include/__cxx03/__charconv/from_chars_integral.h
+++ /dev/null
@@ -1,240 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_FROM_CHARS_INTEGRAL_H
-#define _LIBCPP___CXX03___CHARCONV_FROM_CHARS_INTEGRAL_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__charconv/from_chars_result.h>
-#include <__cxx03/__charconv/traits.h>
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/__type_traits/is_unsigned.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete;
-
-template <typename _It, typename _Tp, typename _Fn, typename... _Ts>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) {
- using __tl = numeric_limits<_Tp>;
- decltype(std::__to_unsigned_like(__value)) __x;
-
- bool __neg = (__first != __last && *__first == '-');
- auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...);
- switch (__r.ec) {
- case errc::invalid_argument:
- return {__first, __r.ec};
- case errc::result_out_of_range:
- return __r;
- default:
- break;
- }
-
- if (__neg) {
- if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) {
- __x = std::__complement(__x);
- std::copy_n(std::addressof(__x), 1, std::addressof(__value));
- return __r;
- }
- } else {
- if (__x <= std::__to_unsigned_like(__tl::max())) {
- __value = __x;
- return __r;
- }
- }
-
- return {__r.ptr, errc::result_out_of_range};
-}
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __in_pattern(_Tp __c) {
- return '0' <= __c && __c <= '9';
-}
-
-struct _LIBCPP_HIDDEN __in_pattern_result {
- bool __ok;
- int __val;
-
- explicit _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; }
-};
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __in_pattern_result __in_pattern(_Tp __c, int __base) {
- if (__base <= 10)
- return {'0' <= __c && __c < '0' + __base, __c - '0'};
- else if (std::__in_pattern(__c))
- return {true, __c - '0'};
- else if ('a' <= __c && __c < 'a' + __base - 10)
- return {true, __c - 'a' + 10};
- else
- return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10};
-}
-
-template <typename _It, typename _Tp, typename _Fn, typename... _Ts>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) {
- auto __find_non_zero = [](_It __firstit, _It __lastit) {
- for (; __firstit != __lastit; ++__firstit)
- if (*__firstit != '0')
- break;
- return __firstit;
- };
-
- auto __p = __find_non_zero(__first, __last);
- if (__p == __last || !std::__in_pattern(*__p, __args...)) {
- if (__p == __first)
- return {__first, errc::invalid_argument};
- else {
- __value = 0;
- return {__p, {}};
- }
- }
-
- auto __r = __f(__p, __last, __value, __args...);
- if (__r.ec == errc::result_out_of_range) {
- for (; __r.ptr != __last; ++__r.ptr) {
- if (!std::__in_pattern(*__r.ptr, __args...))
- break;
- }
- }
-
- return __r;
-}
-
-template <typename _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) {
- using __tx = __itoa::__traits<_Tp>;
- using __output_type = typename __tx::type;
-
- return std::__subject_seq_combinator(
- __first, __last, __value, [](const char* __f, const char* __l, _Tp& __val) -> from_chars_result {
- __output_type __a, __b;
- auto __p = __tx::__read(__f, __l, __a, __b);
- if (__p == __l || !std::__in_pattern(*__p)) {
- __output_type __m = numeric_limits<_Tp>::max();
- if (__m >= __a && __m - __a >= __b) {
- __val = __a + __b;
- return {__p, {}};
- }
- }
- return {__p, errc::result_out_of_range};
- });
-}
-
-template <typename _Tp, __enable_if_t<is_signed<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) {
- using __t = decltype(std::__to_unsigned_like(__value));
- return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>);
-}
-
-/*
-// Code used to generate __from_chars_log2f_lut.
-#include <__cxx03/cmath>
-#include <__cxx03/format>
-#include <__cxx03/iostream>
-
-int main() {
- for (int i = 2; i <= 36; ++i)
- std::cout << std::format("{},\n", log2f(i));
-}
-*/
-/// log2f table for bases [2, 36].
-inline constexpr float __from_chars_log2f_lut[35] = {
- 1, 1.5849625, 2, 2.321928, 2.5849626, 2.807355, 3, 3.169925, 3.321928,
- 3.4594316, 3.5849626, 3.7004397, 3.807355, 3.9068906, 4, 4.087463, 4.169925, 4.2479277,
- 4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355,
- 4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925};
-
-template <typename _Tp, __enable_if_t<is_unsigned<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) {
- if (__base == 10)
- return std::__from_chars_atoi(__first, __last, __value);
-
- return std::__subject_seq_combinator(
- __first,
- __last,
- __value,
- [](const char* __p, const char* __lastp, _Tp& __val, int __b) -> from_chars_result {
- using __tl = numeric_limits<_Tp>;
- // __base is always between 2 and 36 inclusive.
- auto __digits = __tl::digits / __from_chars_log2f_lut[__b - 2];
- _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0;
-
- for (int __i = 1; __p != __lastp; ++__i, ++__p) {
- if (auto __c = __in_pattern(*__p, __b)) {
- if (__i < __digits - 1)
- __x = __x * __b + __c.__val;
- else {
- if (!__itoa::__mul_overflowed(__x, __b, __x))
- ++__p;
- __y = __c.__val;
- break;
- }
- } else
- break;
- }
-
- if (__p == __lastp || !__in_pattern(*__p, __b)) {
- if (__tl::max() - __x >= __y) {
- __val = __x + __y;
- return {__p, {}};
- }
- }
- return {__p, errc::result_out_of_range};
- },
- __base);
-}
-
-template <typename _Tp, __enable_if_t<is_signed<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) {
- using __t = decltype(std::__to_unsigned_like(__value));
- return std::__sign_combinator(__first, __last, __value, __from_chars_integral<__t>, __base);
-}
-
-template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-from_chars(const char* __first, const char* __last, _Tp& __value) {
- return std::__from_chars_atoi(__first, __last, __value);
-}
-
-template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result
-from_chars(const char* __first, const char* __last, _Tp& __value, int __base) {
- _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]");
- return std::__from_chars_integral(__first, __last, __value, __base);
-}
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHARCONV_FROM_CHARS_INTEGRAL_H
diff --git a/libcxx/include/__cxx03/__charconv/from_chars_result.h b/libcxx/include/__cxx03/__charconv/from_chars_result.h
deleted file mode 100644
index 03e490fce56a9..0000000000000
--- a/libcxx/include/__cxx03/__charconv/from_chars_result.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_FROM_CHARS_RESULT_H
-#define _LIBCPP___CXX03___CHARCONV_FROM_CHARS_RESULT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__system_error/errc.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-struct _LIBCPP_EXPORTED_FROM_ABI from_chars_result {
- const char* ptr;
- errc ec;
-# if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const from_chars_result&, const from_chars_result&) = default;
-# endif
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return ec == errc{}; }
-# endif
-};
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_FROM_CHARS_RESULT_H
diff --git a/libcxx/include/__cxx03/__charconv/tables.h b/libcxx/include/__cxx03/__charconv/tables.h
deleted file mode 100644
index 8c9fd3daf170c..0000000000000
--- a/libcxx/include/__cxx03/__charconv/tables.h
+++ /dev/null
@@ -1,163 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TABLES
-#define _LIBCPP___CXX03___CHARCONV_TABLES
-
-#include <__cxx03/__config>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-namespace __itoa {
-
-inline constexpr char __base_2_lut[64] = {
- '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '1', '0', '1', '0', '0', '0', '1',
- '0', '1', '0', '1', '1', '0', '0', '1', '1', '1', '1', '0', '0', '0', '1', '0', '0', '1', '1', '0', '1', '0',
- '1', '0', '1', '1', '1', '1', '0', '0', '1', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '1'};
-
-inline constexpr char __base_8_lut[128] = {
- '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '1', '0', '1', '1', '1', '2',
- '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5',
- '2', '6', '2', '7', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '4', '0',
- '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '5', '0', '5', '1', '5', '2', '5', '3',
- '5', '4', '5', '5', '5', '6', '5', '7', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6',
- '6', '7', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7'};
-
-inline constexpr char __base_16_lut[512] = {
- '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '0', 'a', '0',
- 'b', '0', 'c', '0', 'd', '0', 'e', '0', 'f', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6',
- '1', '7', '1', '8', '1', '9', '1', 'a', '1', 'b', '1', 'c', '1', 'd', '1', 'e', '1', 'f', '2', '0', '2', '1', '2',
- '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '2', 'a', '2', 'b', '2', 'c', '2', 'd',
- '2', 'e', '2', 'f', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3',
- '9', '3', 'a', '3', 'b', '3', 'c', '3', 'd', '3', 'e', '3', 'f', '4', '0', '4', '1', '4', '2', '4', '3', '4', '4',
- '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '4', 'a', '4', 'b', '4', 'c', '4', 'd', '4', 'e', '4', 'f', '5',
- '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '5', 'a', '5', 'b',
- '5', 'c', '5', 'd', '5', 'e', '5', 'f', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6',
- '7', '6', '8', '6', '9', '6', 'a', '6', 'b', '6', 'c', '6', 'd', '6', 'e', '6', 'f', '7', '0', '7', '1', '7', '2',
- '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '7', 'a', '7', 'b', '7', 'c', '7', 'd', '7',
- 'e', '7', 'f', '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9',
- '8', 'a', '8', 'b', '8', 'c', '8', 'd', '8', 'e', '8', 'f', '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9',
- '5', '9', '6', '9', '7', '9', '8', '9', '9', '9', 'a', '9', 'b', '9', 'c', '9', 'd', '9', 'e', '9', 'f', 'a', '0',
- 'a', '1', 'a', '2', 'a', '3', 'a', '4', 'a', '5', 'a', '6', 'a', '7', 'a', '8', 'a', '9', 'a', 'a', 'a', 'b', 'a',
- 'c', 'a', 'd', 'a', 'e', 'a', 'f', 'b', '0', 'b', '1', 'b', '2', 'b', '3', 'b', '4', 'b', '5', 'b', '6', 'b', '7',
- 'b', '8', 'b', '9', 'b', 'a', 'b', 'b', 'b', 'c', 'b', 'd', 'b', 'e', 'b', 'f', 'c', '0', 'c', '1', 'c', '2', 'c',
- '3', 'c', '4', 'c', '5', 'c', '6', 'c', '7', 'c', '8', 'c', '9', 'c', 'a', 'c', 'b', 'c', 'c', 'c', 'd', 'c', 'e',
- 'c', 'f', 'd', '0', 'd', '1', 'd', '2', 'd', '3', 'd', '4', 'd', '5', 'd', '6', 'd', '7', 'd', '8', 'd', '9', 'd',
- 'a', 'd', 'b', 'd', 'c', 'd', 'd', 'd', 'e', 'd', 'f', 'e', '0', 'e', '1', 'e', '2', 'e', '3', 'e', '4', 'e', '5',
- 'e', '6', 'e', '7', 'e', '8', 'e', '9', 'e', 'a', 'e', 'b', 'e', 'c', 'e', 'd', 'e', 'e', 'e', 'f', 'f', '0', 'f',
- '1', 'f', '2', 'f', '3', 'f', '4', 'f', '5', 'f', '6', 'f', '7', 'f', '8', 'f', '9', 'f', 'a', 'f', 'b', 'f', 'c',
- 'f', 'd', 'f', 'e', 'f', 'f'};
-
-inline constexpr uint32_t __pow10_32[10] = {
- UINT32_C(0),
- UINT32_C(10),
- UINT32_C(100),
- UINT32_C(1000),
- UINT32_C(10000),
- UINT32_C(100000),
- UINT32_C(1000000),
- UINT32_C(10000000),
- UINT32_C(100000000),
- UINT32_C(1000000000)};
-
-inline constexpr uint64_t __pow10_64[20] = {
- UINT64_C(0),
- UINT64_C(10),
- UINT64_C(100),
- UINT64_C(1000),
- UINT64_C(10000),
- UINT64_C(100000),
- UINT64_C(1000000),
- UINT64_C(10000000),
- UINT64_C(100000000),
- UINT64_C(1000000000),
- UINT64_C(10000000000),
- UINT64_C(100000000000),
- UINT64_C(1000000000000),
- UINT64_C(10000000000000),
- UINT64_C(100000000000000),
- UINT64_C(1000000000000000),
- UINT64_C(10000000000000000),
- UINT64_C(100000000000000000),
- UINT64_C(1000000000000000000),
- UINT64_C(10000000000000000000)};
-
-# ifndef _LIBCPP_HAS_NO_INT128
-inline constexpr int __pow10_128_offset = 0;
-inline constexpr __uint128_t __pow10_128[40] = {
- UINT64_C(0),
- UINT64_C(10),
- UINT64_C(100),
- UINT64_C(1000),
- UINT64_C(10000),
- UINT64_C(100000),
- UINT64_C(1000000),
- UINT64_C(10000000),
- UINT64_C(100000000),
- UINT64_C(1000000000),
- UINT64_C(10000000000),
- UINT64_C(100000000000),
- UINT64_C(1000000000000),
- UINT64_C(10000000000000),
- UINT64_C(100000000000000),
- UINT64_C(1000000000000000),
- UINT64_C(10000000000000000),
- UINT64_C(100000000000000000),
- UINT64_C(1000000000000000000),
- UINT64_C(10000000000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(100000000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(1000000000000000000),
- __uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000),
- (__uint128_t(UINT64_C(10000000000000000000)) * UINT64_C(10000000000000000000)) * 10};
-# endif
-
-inline constexpr char __digits_base_10[200] = {
- // clang-format off
- '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9',
- '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9',
- '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9',
- '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9',
- '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9',
- '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9',
- '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9',
- '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9',
- '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9',
- '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9'};
-// clang-format on
-
-} // namespace __itoa
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_TABLES
diff --git a/libcxx/include/__cxx03/__charconv/to_chars.h b/libcxx/include/__cxx03/__charconv/to_chars.h
deleted file mode 100644
index e526ce427c22f..0000000000000
--- a/libcxx/include/__cxx03/__charconv/to_chars.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TO_CHARS
-#define _LIBCPP___CXX03___CHARCONV_TO_CHARS
-
-#include <__cxx03/__charconv/to_chars_floating_point.h>
-#include <__cxx03/__charconv/to_chars_integral.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_TO_CHARS
diff --git a/libcxx/include/__cxx03/__charconv/to_chars_base_10.h b/libcxx/include/__cxx03/__charconv/to_chars_base_10.h
deleted file mode 100644
index b13b3e33d8f97..0000000000000
--- a/libcxx/include/__cxx03/__charconv/to_chars_base_10.h
+++ /dev/null
@@ -1,188 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TO_CHARS_BASE_10_H
-#define _LIBCPP___CXX03___CHARCONV_TO_CHARS_BASE_10_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__charconv/tables.h>
-#include <__cxx03/__config>
-#include <__cxx03/cstdint>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-namespace __itoa {
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append1(char* __first, uint32_t __value) noexcept {
- *__first = '0' + static_cast<char>(__value);
- return __first + 1;
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append2(char* __first, uint32_t __value) noexcept {
- return std::copy_n(&__digits_base_10[__value * 2], 2, __first);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append3(char* __first, uint32_t __value) noexcept {
- return __itoa::__append2(__itoa::__append1(__first, __value / 100), __value % 100);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append4(char* __first, uint32_t __value) noexcept {
- return __itoa::__append2(__itoa::__append2(__first, __value / 100), __value % 100);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append5(char* __first, uint32_t __value) noexcept {
- return __itoa::__append4(__itoa::__append1(__first, __value / 10000), __value % 10000);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append6(char* __first, uint32_t __value) noexcept {
- return __itoa::__append4(__itoa::__append2(__first, __value / 10000), __value % 10000);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append7(char* __first, uint32_t __value) noexcept {
- return __itoa::__append6(__itoa::__append1(__first, __value / 1000000), __value % 1000000);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append8(char* __first, uint32_t __value) noexcept {
- return __itoa::__append6(__itoa::__append2(__first, __value / 1000000), __value % 1000000);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __append9(char* __first, uint32_t __value) noexcept {
- return __itoa::__append8(__itoa::__append1(__first, __value / 100000000), __value % 100000000);
-}
-
-template <class _Tp>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __append10(char* __first, _Tp __value) noexcept {
- return __itoa::__append8(__itoa::__append2(__first, static_cast<uint32_t>(__value / 100000000)),
- static_cast<uint32_t>(__value % 100000000));
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
-__base_10_u32(char* __first, uint32_t __value) noexcept {
- if (__value < 1000000) {
- if (__value < 10000) {
- if (__value < 100) {
- // 0 <= __value < 100
- if (__value < 10)
- return __itoa::__append1(__first, __value);
- return __itoa::__append2(__first, __value);
- }
- // 100 <= __value < 10'000
- if (__value < 1000)
- return __itoa::__append3(__first, __value);
- return __itoa::__append4(__first, __value);
- }
-
- // 10'000 <= __value < 1'000'000
- if (__value < 100000)
- return __itoa::__append5(__first, __value);
- return __itoa::__append6(__first, __value);
- }
-
- // __value => 1'000'000
- if (__value < 100000000) {
- // 1'000'000 <= __value < 100'000'000
- if (__value < 10000000)
- return __itoa::__append7(__first, __value);
- return __itoa::__append8(__first, __value);
- }
-
- // 100'000'000 <= __value < max
- if (__value < 1000000000)
- return __itoa::__append9(__first, __value);
- return __itoa::__append10(__first, __value);
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
-__base_10_u64(char* __buffer, uint64_t __value) noexcept {
- if (__value <= UINT32_MAX)
- return __itoa::__base_10_u32(__buffer, static_cast<uint32_t>(__value));
-
- // Numbers in the range UINT32_MAX <= val < 10'000'000'000 always contain 10
- // digits and are outputted after this if statement.
- if (__value >= 10000000000) {
- // This function properly deterimines the first non-zero leading digit.
- __buffer = __itoa::__base_10_u32(__buffer, static_cast<uint32_t>(__value / 10000000000));
- __value %= 10000000000;
- }
- return __itoa::__append10(__buffer, __value);
-}
-
-# ifndef _LIBCPP_HAS_NO_INT128
-/// \returns 10^\a exp
-///
-/// \pre \a exp [19, 39]
-///
-/// \note The lookup table contains a partial set of exponents limiting the
-/// range that can be used. However the range is sufficient for
-/// \ref __base_10_u128.
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept {
- _LIBCPP_ASSERT_INTERNAL(__exp >= __pow10_128_offset, "Index out of bounds");
- return __pow10_128[__exp - __pow10_128_offset];
-}
-
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char*
-__base_10_u128(char* __buffer, __uint128_t __value) noexcept {
- _LIBCPP_ASSERT_INTERNAL(
- __value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fails when this isn't true.");
-
- // Unlike the 64 to 32 bit case the 128 bit case the "upper half" can't be
- // stored in the "lower half". Instead we first need to handle the top most
- // digits separately.
- //
- // Maximum unsigned values
- // 64 bit 18'446'744'073'709'551'615 (20 digits)
- // 128 bit 340'282'366'920'938'463'463'374'607'431'768'211'455 (39 digits)
- // step 1 ^ ([0-1] digits)
- // step 2 ^^^^^^^^^^^^^^^^^^^^^^^^^ ([0-19] digits)
- // step 3 ^^^^^^^^^^^^^^^^^^^^^^^^^ (19 digits)
- if (__value >= __itoa::__pow_10(38)) {
- // step 1
- __buffer = __itoa::__append1(__buffer, static_cast<uint32_t>(__value / __itoa::__pow_10(38)));
- __value %= __itoa::__pow_10(38);
-
- // step 2 always 19 digits.
- // They are handled here since leading zeros need to be appended to the buffer,
- __buffer = __itoa::__append9(__buffer, static_cast<uint32_t>(__value / __itoa::__pow_10(29)));
- __value %= __itoa::__pow_10(29);
- __buffer = __itoa::__append10(__buffer, static_cast<uint64_t>(__value / __itoa::__pow_10(19)));
- __value %= __itoa::__pow_10(19);
- } else {
- // step 2
- // This version needs to determine the position of the leading non-zero digit.
- __buffer = __base_10_u64(__buffer, static_cast<uint64_t>(__value / __itoa::__pow_10(19)));
- __value %= __itoa::__pow_10(19);
- }
-
- // Step 3
- __buffer = __itoa::__append9(__buffer, static_cast<uint32_t>(__value / 10000000000));
- __buffer = __itoa::__append10(__buffer, static_cast<uint64_t>(__value % 10000000000));
-
- return __buffer;
-}
-# endif
-} // namespace __itoa
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHARCONV_TO_CHARS_BASE_10_H
diff --git a/libcxx/include/__cxx03/__charconv/to_chars_floating_point.h b/libcxx/include/__cxx03/__charconv/to_chars_floating_point.h
deleted file mode 100644
index 167ffeae7bedd..0000000000000
--- a/libcxx/include/__cxx03/__charconv/to_chars_floating_point.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TO_CHARS_FLOATING_POINT_H
-#define _LIBCPP___CXX03___CHARCONV_TO_CHARS_FLOATING_POINT_H
-
-#include <__cxx03/__charconv/chars_format.h>
-#include <__cxx03/__charconv/to_chars_result.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, float __value);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, double __value);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, long double __value);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, float __value, chars_format __fmt);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, double __value, chars_format __fmt);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, long double __value, chars_format __fmt);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, float __value, chars_format __fmt, int __precision);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, double __value, chars_format __fmt, int __precision);
-
-_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision);
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_TO_CHARS_FLOATING_POINT_H
diff --git a/libcxx/include/__cxx03/__charconv/to_chars_integral.h b/libcxx/include/__cxx03/__charconv/to_chars_integral.h
deleted file mode 100644
index 2579e02229851..0000000000000
--- a/libcxx/include/__cxx03/__charconv/to_chars_integral.h
+++ /dev/null
@@ -1,327 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TO_CHARS_INTEGRAL_H
-#define _LIBCPP___CXX03___CHARCONV_TO_CHARS_INTEGRAL_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__charconv/tables.h>
-#include <__cxx03/__charconv/to_chars_base_10.h>
-#include <__cxx03/__charconv/to_chars_result.h>
-#include <__cxx03/__charconv/traits.h>
-#include <__cxx03/__config>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/make_32_64_or_128_bit.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-to_chars_result to_chars(char*, char*, bool, int = 10) = delete;
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type);
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) {
- auto __x = std::__to_unsigned_like(__value);
- if (__value < 0 && __first != __last) {
- *__first++ = '-';
- __x = std::__complement(__x);
- }
-
- return std::__to_chars_itoa(__first, __last, __x, false_type());
-}
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) {
- using __tx = __itoa::__traits<_Tp>;
- auto __diff = __last - __first;
-
- if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
- return {__tx::__convert(__first, __value), errc(0)};
- else
- return {__last, errc::value_too_large};
-}
-
-# ifndef _LIBCPP_HAS_NO_INT128
-template <>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) {
- // When the value fits in 64-bits use the 64-bit code path. This reduces
- // the number of expensive calculations on 128-bit values.
- //
- // NOTE the 128-bit code path requires this optimization.
- if (__value <= numeric_limits<uint64_t>::max())
- return __to_chars_itoa(__first, __last, static_cast<uint64_t>(__value), false_type());
-
- using __tx = __itoa::__traits<__uint128_t>;
- auto __diff = __last - __first;
-
- if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
- return {__tx::__convert(__first, __value), errc(0)};
- else
- return {__last, errc::value_too_large};
-}
-# endif
-
-template <class _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type);
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, true_type) {
- auto __x = std::__to_unsigned_like(__value);
- if (__value < 0 && __first != __last) {
- *__first++ = '-';
- __x = std::__complement(__x);
- }
-
- return std::__to_chars_integral(__first, __last, __x, __base, false_type());
-}
-
-namespace __itoa {
-
-template <unsigned _Base>
-struct _LIBCPP_HIDDEN __integral;
-
-template <>
-struct _LIBCPP_HIDDEN __integral<2> {
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
- // If value == 0 still need one digit. If the value != this has no
- // effect since the code scans for the most significant bit set. (Note
- // that __libcpp_clz doesn't work for 0.)
- return numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1);
- }
-
- template <typename _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
- __to_chars(char* __first, char* __last, _Tp __value) {
- ptrdiff_t __cap = __last - __first;
- int __n = __width(__value);
- if (__n > __cap)
- return {__last, errc::value_too_large};
-
- __last = __first + __n;
- char* __p = __last;
- const unsigned __divisor = 16;
- while (__value > __divisor) {
- unsigned __c = __value % __divisor;
- __value /= __divisor;
- __p -= 4;
- std::copy_n(&__base_2_lut[4 * __c], 4, __p);
- }
- do {
- unsigned __c = __value % 2;
- __value /= 2;
- *--__p = "01"[__c];
- } while (__value != 0);
- return {__last, errc(0)};
- }
-};
-
-template <>
-struct _LIBCPP_HIDDEN __integral<8> {
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
- // If value == 0 still need one digit. If the value != this has no
- // effect since the code scans for the most significat bit set. (Note
- // that __libcpp_clz doesn't work for 0.)
- return ((numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1)) + 2) / 3;
- }
-
- template <typename _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
- __to_chars(char* __first, char* __last, _Tp __value) {
- ptrdiff_t __cap = __last - __first;
- int __n = __width(__value);
- if (__n > __cap)
- return {__last, errc::value_too_large};
-
- __last = __first + __n;
- char* __p = __last;
- unsigned __divisor = 64;
- while (__value > __divisor) {
- unsigned __c = __value % __divisor;
- __value /= __divisor;
- __p -= 2;
- std::copy_n(&__base_8_lut[2 * __c], 2, __p);
- }
- do {
- unsigned __c = __value % 8;
- __value /= 8;
- *--__p = "01234567"[__c];
- } while (__value != 0);
- return {__last, errc(0)};
- }
-};
-
-template <>
-struct _LIBCPP_HIDDEN __integral<16> {
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept {
- // If value == 0 still need one digit. If the value != this has no
- // effect since the code scans for the most significat bit set. (Note
- // that __libcpp_clz doesn't work for 0.)
- return (numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1) + 3) / 4;
- }
-
- template <typename _Tp>
- _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result
- __to_chars(char* __first, char* __last, _Tp __value) {
- ptrdiff_t __cap = __last - __first;
- int __n = __width(__value);
- if (__n > __cap)
- return {__last, errc::value_too_large};
-
- __last = __first + __n;
- char* __p = __last;
- unsigned __divisor = 256;
- while (__value > __divisor) {
- unsigned __c = __value % __divisor;
- __value /= __divisor;
- __p -= 2;
- std::copy_n(&__base_16_lut[2 * __c], 2, __p);
- }
- if (__first != __last)
- do {
- unsigned __c = __value % 16;
- __value /= 16;
- *--__p = "0123456789abcdef"[__c];
- } while (__value != 0);
- return {__last, errc(0)};
- }
-};
-
-} // namespace __itoa
-
-template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) >= sizeof(unsigned)), int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) {
- return __itoa::__integral<_Base>::__width(__value);
-}
-
-template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) < sizeof(unsigned)), int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) {
- return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value));
-}
-
-template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) >= sizeof(unsigned)), int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_integral(char* __first, char* __last, _Tp __value) {
- return __itoa::__integral<_Base>::__to_chars(__first, __last, __value);
-}
-
-template <unsigned _Base, typename _Tp, __enable_if_t<(sizeof(_Tp) < sizeof(unsigned)), int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_integral(char* __first, char* __last, _Tp __value) {
- return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value));
-}
-
-template <typename _Tp>
-_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) {
- _LIBCPP_ASSERT_INTERNAL(__value >= 0, "The function requires a non-negative value.");
-
- unsigned __base_2 = __base * __base;
- unsigned __base_3 = __base_2 * __base;
- unsigned __base_4 = __base_2 * __base_2;
-
- int __r = 0;
- while (true) {
- if (__value < __base)
- return __r + 1;
- if (__value < __base_2)
- return __r + 2;
- if (__value < __base_3)
- return __r + 3;
- if (__value < __base_4)
- return __r + 4;
-
- __value /= __base_4;
- __r += 4;
- }
-
- __libcpp_unreachable();
-}
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type) {
- if (__base == 10) [[likely]]
- return std::__to_chars_itoa(__first, __last, __value, false_type());
-
- switch (__base) {
- case 2:
- return std::__to_chars_integral<2>(__first, __last, __value);
- case 8:
- return std::__to_chars_integral<8>(__first, __last, __value);
- case 16:
- return std::__to_chars_integral<16>(__first, __last, __value);
- }
-
- ptrdiff_t __cap = __last - __first;
- int __n = std::__to_chars_integral_width(__value, __base);
- if (__n > __cap)
- return {__last, errc::value_too_large};
-
- __last = __first + __n;
- char* __p = __last;
- do {
- unsigned __c = __value % __base;
- __value /= __base;
- *--__p = "0123456789abcdefghijklmnopqrstuvwxyz"[__c];
- } while (__value != 0);
- return {__last, errc(0)};
-}
-
-template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, _Tp __value) {
- using _Type = __make_32_64_or_128_bit_t<_Tp>;
- static_assert(!is_same<_Type, void>::value, "unsupported integral type used in to_chars");
- return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>());
-}
-
-template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
-to_chars(char* __first, char* __last, _Tp __value, int __base) {
- _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]");
-
- using _Type = __make_32_64_or_128_bit_t<_Tp>;
- return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base, is_signed<_Tp>());
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHARCONV_TO_CHARS_INTEGRAL_H
diff --git a/libcxx/include/__cxx03/__charconv/to_chars_result.h b/libcxx/include/__cxx03/__charconv/to_chars_result.h
deleted file mode 100644
index 82a60db6f6741..0000000000000
--- a/libcxx/include/__cxx03/__charconv/to_chars_result.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TO_CHARS_RESULT_H
-#define _LIBCPP___CXX03___CHARCONV_TO_CHARS_RESULT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__system_error/errc.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-struct _LIBCPP_EXPORTED_FROM_ABI to_chars_result {
- char* ptr;
- errc ec;
-# if _LIBCPP_STD_VER >= 20
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const to_chars_result&, const to_chars_result&) = default;
-# endif
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return ec == errc{}; }
-# endif
-};
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHARCONV_TO_CHARS_RESULT_H
diff --git a/libcxx/include/__cxx03/__charconv/traits.h b/libcxx/include/__cxx03/__charconv/traits.h
deleted file mode 100644
index 110ff9c07e7d0..0000000000000
--- a/libcxx/include/__cxx03/__charconv/traits.h
+++ /dev/null
@@ -1,200 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHARCONV_TRAITS
-#define _LIBCPP___CXX03___CHARCONV_TRAITS
-
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__charconv/tables.h>
-#include <__cxx03/__charconv/to_chars_base_10.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_unsigned.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-namespace __itoa {
-
-template <typename _Tp, typename = void>
-struct _LIBCPP_HIDDEN __traits_base;
-
-template <typename _Tp>
-struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uint32_t)>> {
- using type = uint32_t;
-
- /// The width estimation using a log10 algorithm.
- ///
- /// The algorithm is based on
- /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
- /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
- /// function requires its input to have at least one bit set the value of
- /// zero is set to one. This means the first element of the lookup table is
- /// zero.
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) {
- auto __t = (32 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12;
- return __t - (__v < __itoa::__pow10_32[__t]) + 1;
- }
-
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) {
- return __itoa::__base_10_u32(__p, __v);
- }
-
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() {
- return __itoa::__pow10_32;
- }
-};
-
-template <typename _Tp>
-struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uint64_t)>> {
- using type = uint64_t;
-
- /// The width estimation using a log10 algorithm.
- ///
- /// The algorithm is based on
- /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
- /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
- /// function requires its input to have at least one bit set the value of
- /// zero is set to one. This means the first element of the lookup table is
- /// zero.
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) {
- auto __t = (64 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12;
- return __t - (__v < __itoa::__pow10_64[__t]) + 1;
- }
-
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) {
- return __itoa::__base_10_u64(__p, __v);
- }
-
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() {
- return __itoa::__pow10_64;
- }
-};
-
-# ifndef _LIBCPP_HAS_NO_INT128
-template <typename _Tp>
-struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__uint128_t)> > {
- using type = __uint128_t;
-
- /// The width estimation using a log10 algorithm.
- ///
- /// The algorithm is based on
- /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
- /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that
- /// function requires its input to have at least one bit set the value of
- /// zero is set to one. This means the first element of the lookup table is
- /// zero.
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) {
- _LIBCPP_ASSERT_INTERNAL(
- __v > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true.");
- // There's always a bit set in the upper 64-bits.
- auto __t = (128 - std::__libcpp_clz(static_cast<uint64_t>(__v >> 64))) * 1233 >> 12;
- _LIBCPP_ASSERT_INTERNAL(__t >= __itoa::__pow10_128_offset, "Index out of bounds");
- // __t is adjusted since the lookup table misses the lower entries.
- return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1;
- }
-
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) {
- return __itoa::__base_10_u128(__p, __v);
- }
-
- // TODO FMT This pow function should get an index.
- // By moving this to its own header it can be reused by the pow function in to_chars_base_10.
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_128)& __pow() {
- return __itoa::__pow10_128;
- }
-};
-# endif
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool
-__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) {
- auto __c = __a * __b;
- __r = __c;
- return __c > numeric_limits<unsigned char>::max();
-}
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool
-__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) {
- auto __c = __a * __b;
- __r = __c;
- return __c > numeric_limits<unsigned short>::max();
-}
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) {
- static_assert(is_unsigned<_Tp>::value, "");
- return __builtin_mul_overflow(__a, __b, &__r);
-}
-
-template <typename _Tp, typename _Up>
-inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) {
- return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r);
-}
-
-template <typename _Tp>
-struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> {
- static constexpr int digits = numeric_limits<_Tp>::digits10 + 1;
- using __traits_base<_Tp>::__pow;
- using typename __traits_base<_Tp>::type;
-
- // precondition: at least one non-zero character available
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char const*
- __read(char const* __p, char const* __ep, type& __a, type& __b) {
- type __cprod[digits];
- int __j = digits - 1;
- int __i = digits;
- do {
- if (*__p < '0' || *__p > '9')
- break;
- __cprod[--__i] = *__p++ - '0';
- } while (__p != __ep && __i != 0);
-
- __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, __cprod[__i]);
- if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b))
- --__p;
- return __p;
- }
-
- template <typename _It1, typename _It2, class _Up>
- static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Up
- __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) {
- for (; __first1 < __last1; ++__first1, ++__first2)
- __init = __init + *__first1 * *__first2;
- return __init;
- }
-};
-
-} // namespace __itoa
-
-template <typename _Tp>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Tp __complement(_Tp __x) {
- static_assert(is_unsigned<_Tp>::value, "cast to unsigned first");
- return _Tp(~__x + 1);
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHARCONV_TRAITS
diff --git a/libcxx/include/__cxx03/__chrono/calendar.h b/libcxx/include/__cxx03/__chrono/calendar.h
deleted file mode 100644
index 4113ca435cc1e..0000000000000
--- a/libcxx/include/__cxx03/__chrono/calendar.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_CALENDAR_H
-#define _LIBCPP___CXX03___CHRONO_CALENDAR_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-struct local_t {};
-template <class _Duration>
-using local_time = time_point<local_t, _Duration>;
-using local_seconds = local_time<seconds>;
-using local_days = local_time<days>;
-
-struct last_spec {
- explicit last_spec() = default;
-};
-inline constexpr last_spec last{};
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_CALENDAR_H
diff --git a/libcxx/include/__cxx03/__chrono/concepts.h b/libcxx/include/__cxx03/__chrono/concepts.h
deleted file mode 100644
index 55a2c54fc3f5b..0000000000000
--- a/libcxx/include/__cxx03/__chrono/concepts.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_CONCEPTS_H
-#define _LIBCPP___CXX03___CHRONO_CONCEPTS_H
-
-#include <__cxx03/__chrono/hh_mm_ss.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_specialization.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>
-concept __is_hh_mm_ss = __is_specialization_v<_Tp, chrono::hh_mm_ss>;
-
-template <class _Tp>
-concept __is_time_point = __is_specialization_v<_Tp, chrono::time_point>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHRONO_CONCEPTS_H
diff --git a/libcxx/include/__cxx03/__chrono/convert_to_tm.h b/libcxx/include/__cxx03/__chrono/convert_to_tm.h
deleted file mode 100644
index e02ede48317b7..0000000000000
--- a/libcxx/include/__cxx03/__chrono/convert_to_tm.h
+++ /dev/null
@@ -1,202 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_CONVERT_TO_TM_H
-#define _LIBCPP___CXX03___CHRONO_CONVERT_TO_TM_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/concepts.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/file_clock.h>
-#include <__cxx03/__chrono/hh_mm_ss.h>
-#include <__cxx03/__chrono/local_info.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/month_weekday.h>
-#include <__cxx03/__chrono/monthday.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__chrono/sys_info.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__chrono/weekday.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__chrono/year_month.h>
-#include <__cxx03/__chrono/year_month_day.h>
-#include <__cxx03/__chrono/year_month_weekday.h>
-#include <__cxx03/__chrono/zoned_time.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_specialization.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/ctime>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// Conerts a chrono date and weekday to a given _Tm type.
-//
-// This is an implementation detail for the function
-// template <class _Tm, class _ChronoT>
-// _Tm __convert_to_tm(const _ChronoT& __value)
-//
-// This manually converts the two values to the proper type. It is possible to
-// convert from sys_days to time_t and then to _Tm. But this leads to the Y2K
-// bug when time_t is a 32-bit signed integer. Chrono considers years beyond
-// the year 2038 valid, so instead do the transformation manually.
-template <class _Tm, class _Date>
- requires(same_as<_Date, chrono::year_month_day> || same_as<_Date, chrono::year_month_day_last>)
-_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _Date& __date, chrono::weekday __weekday) {
- _Tm __result = {};
-# ifdef __GLIBC__
- __result.tm_zone = "UTC";
-# endif
- __result.tm_year = static_cast<int>(__date.year()) - 1900;
- __result.tm_mon = static_cast<unsigned>(__date.month()) - 1;
- __result.tm_mday = static_cast<unsigned>(__date.day());
- __result.tm_wday = static_cast<unsigned>(__weekday.c_encoding());
- __result.tm_yday =
- (static_cast<chrono::sys_days>(__date) -
- static_cast<chrono::sys_days>(chrono::year_month_day{__date.year(), chrono::January, chrono::day{1}}))
- .count();
-
- return __result;
-}
-
-template <class _Tm, class _Duration>
-_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const chrono::sys_time<_Duration> __tp) {
- chrono::sys_days __days = chrono::floor<chrono::days>(__tp);
- chrono::year_month_day __ymd{__days};
-
- _Tm __result = std::__convert_to_tm<_Tm>(chrono::year_month_day{__ymd}, chrono::weekday{__days});
-
- uint64_t __sec =
- chrono::duration_cast<chrono::seconds>(__tp - chrono::time_point_cast<chrono::seconds>(__days)).count();
- __sec %= 24 * 3600;
- __result.tm_hour = __sec / 3600;
- __sec %= 3600;
- __result.tm_min = __sec / 60;
- __result.tm_sec = __sec % 60;
-
- return __result;
-}
-
-// Convert a chrono (calendar) time point, or dururation to the given _Tm type,
-// which must have the same properties as std::tm.
-template <class _Tm, class _ChronoT>
-_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(const _ChronoT& __value) {
- _Tm __result = {};
-# ifdef __GLIBC__
- __result.tm_zone = "UTC";
-# endif
-
- if constexpr (__is_time_point<_ChronoT>) {
- if constexpr (same_as<typename _ChronoT::clock, chrono::system_clock>)
- return std::__convert_to_tm<_Tm>(__value);
- else if constexpr (same_as<typename _ChronoT::clock, chrono::file_clock>)
- return std::__convert_to_tm<_Tm>(_ChronoT::clock::to_sys(__value));
- else if constexpr (same_as<typename _ChronoT::clock, chrono::local_t>)
- return std::__convert_to_tm<_Tm>(chrono::sys_time<typename _ChronoT::duration>{__value.time_since_epoch()});
- else
- static_assert(sizeof(_ChronoT) == 0, "TODO: Add the missing clock specialization");
- } else if constexpr (chrono::__is_duration<_ChronoT>::value) {
- // [time.format]/6
- // ... However, if a flag refers to a "time of day" (e.g. %H, %I, %p,
- // etc.), then a specialization of duration is interpreted as the time of
- // day elapsed since midnight.
-
- // Not all values can be converted to hours, it may run into ratio
- // conversion errors. In that case the conversion to seconds works.
- if constexpr (is_convertible_v<_ChronoT, chrono::hours>) {
- auto __hour = chrono::floor<chrono::hours>(__value);
- auto __sec = chrono::duration_cast<chrono::seconds>(__value - __hour);
- __result.tm_hour = __hour.count() % 24;
- __result.tm_min = __sec.count() / 60;
- __result.tm_sec = __sec.count() % 60;
- } else {
- uint64_t __sec = chrono::duration_cast<chrono::seconds>(__value).count();
- __sec %= 24 * 3600;
- __result.tm_hour = __sec / 3600;
- __sec %= 3600;
- __result.tm_min = __sec / 60;
- __result.tm_sec = __sec % 60;
- }
- } else if constexpr (same_as<_ChronoT, chrono::day>)
- __result.tm_mday = static_cast<unsigned>(__value);
- else if constexpr (same_as<_ChronoT, chrono::month>)
- __result.tm_mon = static_cast<unsigned>(__value) - 1;
- else if constexpr (same_as<_ChronoT, chrono::year>)
- __result.tm_year = static_cast<int>(__value) - 1900;
- else if constexpr (same_as<_ChronoT, chrono::weekday>)
- __result.tm_wday = __value.c_encoding();
- else if constexpr (same_as<_ChronoT, chrono::weekday_indexed> || same_as<_ChronoT, chrono::weekday_last>)
- __result.tm_wday = __value.weekday().c_encoding();
- else if constexpr (same_as<_ChronoT, chrono::month_day>) {
- __result.tm_mday = static_cast<unsigned>(__value.day());
- __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
- } else if constexpr (same_as<_ChronoT, chrono::month_day_last>) {
- __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
- } else if constexpr (same_as<_ChronoT, chrono::month_weekday> || same_as<_ChronoT, chrono::month_weekday_last>) {
- __result.tm_wday = __value.weekday_indexed().weekday().c_encoding();
- __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
- } else if constexpr (same_as<_ChronoT, chrono::year_month>) {
- __result.tm_year = static_cast<int>(__value.year()) - 1900;
- __result.tm_mon = static_cast<unsigned>(__value.month()) - 1;
- } else if constexpr (same_as<_ChronoT, chrono::year_month_day> || same_as<_ChronoT, chrono::year_month_day_last>) {
- return std::__convert_to_tm<_Tm>(
- chrono::year_month_day{__value}, chrono::weekday{static_cast<chrono::sys_days>(__value)});
- } else if constexpr (same_as<_ChronoT, chrono::year_month_weekday> ||
- same_as<_ChronoT, chrono::year_month_weekday_last>) {
- return std::__convert_to_tm<_Tm>(chrono::year_month_day{static_cast<chrono::sys_days>(__value)}, __value.weekday());
- } else if constexpr (__is_hh_mm_ss<_ChronoT>) {
- __result.tm_sec = __value.seconds().count();
- __result.tm_min = __value.minutes().count();
- // In libc++ hours is stored as a long. The type in std::tm is an int. So
- // the overflow can only occur when hour uses more bits than an int
- // provides.
- if constexpr (sizeof(std::chrono::hours::rep) > sizeof(__result.tm_hour))
- if (__value.hours().count() > std::numeric_limits<decltype(__result.tm_hour)>::max())
- std::__throw_format_error("Formatting hh_mm_ss, encountered an hour overflow");
- __result.tm_hour = __value.hours().count();
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- } else if constexpr (same_as<_ChronoT, chrono::sys_info>) {
- // Has no time information.
- } else if constexpr (same_as<_ChronoT, chrono::local_info>) {
- // Has no time information.
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- } else if constexpr (__is_specialization_v<_ChronoT, chrono::zoned_time>) {
- return std::__convert_to_tm<_Tm>(
- chrono::sys_time<typename _ChronoT::duration>{__value.get_local_time().time_since_epoch()});
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- } else
- static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization");
-
- return __result;
-}
-
-#endif // if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHRONO_CONVERT_TO_TM_H
diff --git a/libcxx/include/__cxx03/__chrono/day.h b/libcxx/include/__cxx03/__chrono/day.h
deleted file mode 100644
index 6b989ea3c6c24..0000000000000
--- a/libcxx/include/__cxx03/__chrono/day.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_DAY_H
-#define _LIBCPP___CXX03___CHRONO_DAY_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class day {
-private:
- unsigned char __d_;
-
-public:
- day() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr day(unsigned __val) noexcept
- : __d_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator++() noexcept {
- ++__d_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator++(int) noexcept {
- day __tmp = *this;
- ++(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day& operator--() noexcept {
- --__d_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr day operator--(int) noexcept {
- day __tmp = *this;
- --(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __lhs, const day& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
- return day(static_cast<unsigned>(__lhs) + __rhs.count());
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
- return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs)));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator+=(const days& __dd) noexcept {
- *this = *this + __dd;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) noexcept {
- *this = *this - __dd;
- return *this;
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_DAY_H
diff --git a/libcxx/include/__cxx03/__chrono/duration.h b/libcxx/include/__cxx03/__chrono/duration.h
index fd936eda44eef..e5c4ca97e5743 100644
--- a/libcxx/include/__cxx03/__chrono/duration.h
+++ b/libcxx/include/__cxx03/__chrono/duration.h
@@ -10,8 +10,6 @@
#ifndef _LIBCPP___CXX03___CHRONO_DURATION_H
#define _LIBCPP___CXX03___CHRONO_DURATION_H
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/three_way_comparable.h>
#include <__cxx03/__config>
#include <__cxx03/__type_traits/common_type.h>
#include <__cxx03/__type_traits/enable_if.h>
diff --git a/libcxx/include/__cxx03/__chrono/exception.h b/libcxx/include/__cxx03/__chrono/exception.h
deleted file mode 100644
index 4db9d8c1c4edf..0000000000000
--- a/libcxx/include/__cxx03/__chrono/exception.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_EXCEPTION_H
-#define _LIBCPP___CXX03___CHRONO_EXCEPTION_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/calendar.h>
-# include <__cxx03/__chrono/local_info.h>
-# include <__cxx03/__chrono/time_point.h>
-# include <__cxx03/__config>
-# include <__cxx03/__configuration/availability.h>
-# include <__cxx03/__verbose_abort>
-# include <__cxx03/format>
-# include <__cxx03/stdexcept>
-# include <__cxx03/string>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20
-
-namespace chrono {
-
-class nonexistent_local_time : public runtime_error {
-public:
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const local_time<_Duration>& __time, const local_info& __info)
- : runtime_error{__create_message(__time, __info)} {
- // [time.zone.exception.nonexist]/2
- // Preconditions: i.result == local_info::nonexistent is true.
- // The value of __info.result is not used.
- _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::nonexistent,
- "creating an nonexistent_local_time from a local_info that is not non-existent");
- }
-
- _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const nonexistent_local_time&) = default;
- _LIBCPP_HIDE_FROM_ABI nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
-
- _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
-
-private:
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
- return std::format(
- R"({} is in a gap between
-{} {} and
-{} {} which are both equivalent to
-{} UTC)",
- __time,
- local_seconds{__info.first.end.time_since_epoch()} + __info.first.offset,
- __info.first.abbrev,
- local_seconds{__info.second.begin.time_since_epoch()} + __info.second.offset,
- __info.second.abbrev,
- __info.first.end);
- }
-};
-
-template <class _Duration>
-_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
- [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw nonexistent_local_time(__time, __info);
-# else
- _LIBCPP_VERBOSE_ABORT("nonexistent_local_time was thrown in -fno-exceptions mode");
-# endif
-}
-
-class ambiguous_local_time : public runtime_error {
-public:
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const local_time<_Duration>& __time, const local_info& __info)
- : runtime_error{__create_message(__time, __info)} {
- // [time.zone.exception.ambig]/2
- // Preconditions: i.result == local_info::ambiguous is true.
- // The value of __info.result is not used.
- _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::ambiguous,
- "creating an ambiguous_local_time from a local_info that is not ambiguous");
- }
-
- _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const ambiguous_local_time&) = default;
- _LIBCPP_HIDE_FROM_ABI ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
-
- _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
-
-private:
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
- return std::format(
- // There are two spaces after the full-stop; this has been verified
- // in the sources of the Standard.
- R"({0} is ambiguous. It could be
-{0} {1} == {2} UTC or
-{0} {3} == {4} UTC)",
- __time,
- __info.first.abbrev,
- __time - __info.first.offset,
- __info.second.abbrev,
- __time - __info.second.offset);
- }
-};
-
-template <class _Duration>
-_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
- [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw ambiguous_local_time(__time, __info);
-# else
- _LIBCPP_VERBOSE_ABORT("ambiguous_local_time was thrown in -fno-exceptions mode");
-# endif
-}
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_EXCEPTION_H
diff --git a/libcxx/include/__cxx03/__chrono/file_clock.h b/libcxx/include/__cxx03/__chrono/file_clock.h
deleted file mode 100644
index 6e2d32b4ef88a..0000000000000
--- a/libcxx/include/__cxx03/__chrono/file_clock.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_FILE_CLOCK_H
-#define _LIBCPP___CXX03___CHRONO_FILE_CLOCK_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-#include <__cxx03/ratio>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifndef _LIBCPP_CXX03_LANG
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-struct _FilesystemClock;
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-#endif // !_LIBCPP_CXX03_LANG
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-// [time.clock.file], type file_clock
-using file_clock = filesystem::_FilesystemClock;
-
-template <class _Duration>
-using file_time = time_point<file_clock, _Duration>;
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#ifndef _LIBCPP_CXX03_LANG
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-struct _FilesystemClock {
-# if !defined(_LIBCPP_HAS_NO_INT128)
- typedef __int128_t rep;
- typedef nano period;
-# else
- typedef long long rep;
- typedef nano period;
-# endif
-
- typedef chrono::duration<rep, period> duration;
- typedef chrono::time_point<_FilesystemClock> time_point;
-
- _LIBCPP_EXPORTED_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14 const bool is_steady = false;
-
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI static time_point now() noexcept;
-
-# if _LIBCPP_STD_VER >= 20
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) {
- return chrono::sys_time<_Duration>(__t.time_since_epoch());
- }
-
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) {
- return chrono::file_time<_Duration>(__t.time_since_epoch());
- }
-# endif // _LIBCPP_STD_VER >= 20
-};
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-#endif // !_LIBCPP_CXX03_LANG
-
-#endif // _LIBCPP___CXX03___CHRONO_FILE_CLOCK_H
diff --git a/libcxx/include/__cxx03/__chrono/formatter.h b/libcxx/include/__cxx03/__chrono/formatter.h
deleted file mode 100644
index 823f6e34c5361..0000000000000
--- a/libcxx/include/__cxx03/__chrono/formatter.h
+++ /dev/null
@@ -1,990 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_FORMATTER_H
-#define _LIBCPP___CXX03___CHRONO_FORMATTER_H
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/concepts.h>
-#include <__cxx03/__chrono/convert_to_tm.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/file_clock.h>
-#include <__cxx03/__chrono/hh_mm_ss.h>
-#include <__cxx03/__chrono/local_info.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/month_weekday.h>
-#include <__cxx03/__chrono/monthday.h>
-#include <__cxx03/__chrono/ostream.h>
-#include <__cxx03/__chrono/parser_std_format_spec.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__chrono/sys_info.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__chrono/weekday.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__chrono/year_month.h>
-#include <__cxx03/__chrono/year_month_day.h>
-#include <__cxx03/__chrono/year_month_weekday.h>
-#include <__cxx03/__chrono/zoned_time.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/format_functions.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__format/write_escaped.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/is_specialization.h>
-#include <__cxx03/cmath>
-#include <__cxx03/ctime>
-#include <__cxx03/limits>
-#include <__cxx03/sstream>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __formatter {
-
-/// Formats a time based on a tm struct.
-///
-/// This formatter passes the formatting to time_put which uses strftime. When
-/// the value is outside the valid range it's unspecified what strftime will
-/// output. For example weekday 8 can print 1 when the day is processed modulo
-/// 7 since that handles the Sunday for 0-based weekday. It can also print 8 if
-/// 7 is handled as a special case.
-///
-/// The Standard doesn't specify what to do in this case so the result depends
-/// on the result of the underlying code.
-///
-/// \pre When the (abbreviated) weekday or month name are used, the caller
-/// validates whether the value is valid. So the caller handles that
-/// requirement of Table 97: Meaning of conversion specifiers
-/// [tab:time.format.spec].
-///
-/// When no chrono-specs are provided it uses the stream formatter.
-
-// For tiny ratios it's not possible to convert a duration to a hh_mm_ss. This
-// fails compile-time due to the limited precision of the ratio (64-bit is too
-// small). Therefore a duration uses its own conversion.
-template <class _CharT, class _Rep, class _Period>
-_LIBCPP_HIDE_FROM_ABI void
-__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::duration<_Rep, _Period>& __value) {
- __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point();
-
- using __duration = chrono::duration<_Rep, _Period>;
-
- auto __fraction = __value - chrono::duration_cast<chrono::seconds>(__value);
- // Converts a negative fraction to its positive value.
- if (__value < chrono::seconds{0} && __fraction != __duration{0})
- __fraction += chrono::seconds{1};
- if constexpr (chrono::treat_as_floating_point_v<_Rep>)
- // When the floating-point value has digits itself they are ignored based
- // on the wording in [tab:time.format.spec]
- // If the precision of the input cannot be exactly represented with
- // seconds, then the format is a decimal floating-point number with a
- // fixed format and a precision matching that of the precision of the
- // input (or to a microseconds precision if the conversion to
- // floating-point decimal seconds cannot be made within 18 fractional
- // digits).
- //
- // This matches the behaviour of MSVC STL, fmtlib interprets this
- // differently and uses 3 decimals.
- // https://godbolt.org/z/6dsbnW8ba
- std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"),
- chrono::duration_cast<typename chrono::hh_mm_ss<__duration>::precision>(__fraction).count(),
- chrono::hh_mm_ss<__duration>::fractional_width);
- else
- std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"),
- chrono::duration_cast<typename chrono::hh_mm_ss<__duration>::precision>(__fraction).count(),
- chrono::hh_mm_ss<__duration>::fractional_width);
-}
-
-template <class _CharT, __is_time_point _Tp>
-_LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(basic_stringstream<_CharT>& __sstr, const _Tp& __value) {
- __formatter::__format_sub_seconds(__sstr, __value.time_since_epoch());
-}
-
-template <class _CharT, class _Duration>
-_LIBCPP_HIDE_FROM_ABI void
-__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::hh_mm_ss<_Duration>& __value) {
- __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point();
- if constexpr (chrono::treat_as_floating_point_v<typename _Duration::rep>)
- std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"),
- __value.subseconds().count(),
- __value.fractional_width);
- else
- std::format_to(std::ostreambuf_iterator<_CharT>{__sstr},
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"),
- __value.subseconds().count(),
- __value.fractional_width);
-}
-
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \
- !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template <class _CharT, class _Duration, class _TimeZonePtr>
-_LIBCPP_HIDE_FROM_ABI void
-__format_sub_seconds(basic_stringstream<_CharT>& __sstr, const chrono::zoned_time<_Duration, _TimeZonePtr>& __value) {
- __formatter::__format_sub_seconds(__sstr, __value.get_local_time().time_since_epoch());
-}
-# endif
-
-template <class _Tp>
-consteval bool __use_fraction() {
- if constexpr (__is_time_point<_Tp>)
- return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB) && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && \
- !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width;
-# endif
- else if constexpr (chrono::__is_duration<_Tp>::value)
- return chrono::hh_mm_ss<_Tp>::fractional_width;
- else if constexpr (__is_hh_mm_ss<_Tp>)
- return _Tp::fractional_width;
- else
- return false;
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void __format_year(basic_stringstream<_CharT>& __sstr, int __year) {
- if (__year < 0) {
- __sstr << _CharT('-');
- __year = -__year;
- }
-
- // TODO FMT Write an issue
- // If the result has less than four digits it is zero-padded with 0 to two digits.
- // is less -> has less
- // left-padded -> zero-padded, otherwise the proper value would be 000-0.
-
- // Note according to the wording it should be left padded, which is odd.
- __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:04}"), __year);
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void __format_century(basic_stringstream<_CharT>& __sstr, int __year) {
- // TODO FMT Write an issue
- // [tab:time.format.spec]
- // %C The year divided by 100 using floored division. If the result is a
- // single decimal digit, it is prefixed with 0.
-
- bool __negative = __year < 0;
- int __century = (__year - (99 * __negative)) / 100; // floored division
- __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __century);
-}
-
-// Implements the %z format specifier according to [tab:time.format.spec], where
-// '__modifier' signals %Oz or %Ez were used. (Both modifiers behave the same,
-// so there is no need to distinguish between them.)
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void
-__format_zone_offset(basic_stringstream<_CharT>& __sstr, chrono::seconds __offset, bool __modifier) {
- if (__offset < 0s) {
- __sstr << _CharT('-');
- __offset = -__offset;
- } else {
- __sstr << _CharT('+');
- }
-
- chrono::hh_mm_ss __hms{__offset};
- std::ostreambuf_iterator<_CharT> __out_it{__sstr};
- // Note HMS does not allow formatting hours > 23, but the offset is not limited to 24H.
- std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __hms.hours().count());
- if (__modifier)
- __sstr << _CharT(':');
- std::format_to(__out_it, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), __hms.minutes().count());
-}
-
-// Helper to store the time zone information needed for formatting.
-struct _LIBCPP_HIDE_FROM_ABI __time_zone {
- // Typically these abbreviations are short and fit in the string's internal
- // buffer.
- string __abbrev;
- chrono::seconds __offset;
-};
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI __time_zone __convert_to_time_zone([[maybe_unused]] const _Tp& __value) {
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- if constexpr (same_as<_Tp, chrono::sys_info>)
- return {__value.abbrev, __value.offset};
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return __formatter::__convert_to_time_zone(__value.get_info());
-# endif
- else
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- return {"UTC", chrono::seconds{0}};
-}
-
-template <class _CharT, class _Tp>
-_LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs(
- basic_stringstream<_CharT>& __sstr, const _Tp& __value, basic_string_view<_CharT> __chrono_specs) {
- tm __t = std::__convert_to_tm<tm>(__value);
- __time_zone __z = __formatter::__convert_to_time_zone(__value);
- const auto& __facet = std::use_facet<time_put<_CharT>>(__sstr.getloc());
- for (auto __it = __chrono_specs.begin(); __it != __chrono_specs.end(); ++__it) {
- if (*__it == _CharT('%')) {
- auto __s = __it;
- ++__it;
- // We only handle the types that can't be directly handled by time_put.
- // (as an optimization n, t, and % are also handled directly.)
- switch (*__it) {
- case _CharT('n'):
- __sstr << _CharT('\n');
- break;
- case _CharT('t'):
- __sstr << _CharT('\t');
- break;
- case _CharT('%'):
- __sstr << *__it;
- break;
-
- case _CharT('C'): {
- // strftime's output is only defined in the range [00, 99].
- int __year = __t.tm_year + 1900;
- if (__year < 1000 || __year > 9999)
- __formatter::__format_century(__sstr, __year);
- else
- __facet.put(
- {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
- } break;
-
- case _CharT('j'):
- if constexpr (chrono::__is_duration<_Tp>::value)
- // Converting a duration where the period has a small ratio to days
- // may fail to compile. This due to loss of precision in the
- // conversion. In order to avoid that issue convert to seconds as
- // an intemediate step.
- __sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count();
- else
- __facet.put(
- {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
- break;
-
- case _CharT('q'):
- if constexpr (chrono::__is_duration<_Tp>::value) {
- __sstr << chrono::__units_suffix<_CharT, typename _Tp::period>();
- break;
- }
- __builtin_unreachable();
-
- case _CharT('Q'):
- // TODO FMT Determine the proper ideas
- // - Should it honour the precision?
- // - Shoult it honour the locale setting for the separators?
- // The wording for Q doesn't use the word locale and the effect of
- // precision is unspecified.
- //
- // MSVC STL ignores precision but uses separator
- // FMT honours precision and has a bug for separator
- // https://godbolt.org/z/78b7sMxns
- if constexpr (chrono::__is_duration<_Tp>::value) {
- __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{}"), __value.count());
- break;
- }
- __builtin_unreachable();
-
- case _CharT('S'):
- case _CharT('T'):
- __facet.put(
- {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
- if constexpr (__use_fraction<_Tp>())
- __formatter::__format_sub_seconds(__sstr, __value);
- break;
-
- // Unlike time_put and strftime the formatting library requires %Y
- //
- // [tab:time.format.spec]
- // The year as a decimal number. If the result is less than four digits
- // it is left-padded with 0 to four digits.
- //
- // This means years in the range (-1000, 1000) need manual formatting.
- // It's unclear whether %EY needs the same treatment. For example the
- // Japanese EY contains the era name and year. This is zero-padded to 2
- // digits in time_put (note that older glibc versions didn't do
- // padding.) However most eras won't reach 100 years, let alone 1000.
- // So padding to 4 digits seems unwanted for Japanese.
- //
- // The same applies to %Ex since that too depends on the era.
- //
- // %x the locale's date representation is currently doesn't handle the
- // zero-padding too.
- //
- // The 4 digits can be implemented better at a later time. On POSIX
- // systems the required information can be extracted by nl_langinfo
- // https://man7.org/linux/man-pages/man3/nl_langinfo.3.html
- //
- // Note since year < -1000 is expected to be rare it uses the more
- // expensive year routine.
- //
- // TODO FMT evaluate the comment above.
-
-# if defined(__GLIBC__) || defined(_AIX) || defined(_WIN32)
- case _CharT('y'):
- // Glibc fails for negative values, AIX for positive values too.
- __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02}"), (std::abs(__t.tm_year + 1900)) % 100);
- break;
-# endif // defined(__GLIBC__) || defined(_AIX) || defined(_WIN32)
-
- case _CharT('Y'):
- // Depending on the platform's libc the range of supported years is
- // limited. Instead of of testing all conditions use the internal
- // implementation unconditionally.
- __formatter::__format_year(__sstr, __t.tm_year + 1900);
- break;
-
- case _CharT('F'):
- // Depending on the platform's libc the range of supported years is
- // limited. Instead of testing all conditions use the internal
- // implementation unconditionally.
- __formatter::__format_year(__sstr, __t.tm_year + 1900);
- __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday);
- break;
-
- case _CharT('z'):
- __formatter::__format_zone_offset(__sstr, __z.__offset, false);
- break;
-
- case _CharT('Z'):
- // __abbrev is always a char so the copy may convert.
- ranges::copy(__z.__abbrev, std::ostreambuf_iterator<_CharT>{__sstr});
- break;
-
- case _CharT('O'):
- if constexpr (__use_fraction<_Tp>()) {
- // Handle OS using the normal representation for the non-fractional
- // part. There seems to be no locale information regarding how the
- // fractional part should be formatted.
- if (*(__it + 1) == 'S') {
- ++__it;
- __facet.put(
- {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
- __formatter::__format_sub_seconds(__sstr, __value);
- break;
- }
- }
-
- // Oz produces the same output as Ez below.
- [[fallthrough]];
- case _CharT('E'):
- ++__it;
- if (*__it == 'z') {
- __formatter::__format_zone_offset(__sstr, __z.__offset, true);
- break;
- }
- [[fallthrough]];
- default:
- __facet.put(
- {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1));
- break;
- }
- } else {
- __sstr << *__it;
- }
- }
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) {
- if constexpr (__is_time_point<_Tp>)
- return true;
- else if constexpr (same_as<_Tp, chrono::day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_weekday>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::year_month>)
- return true;
- else if constexpr (same_as<_Tp, chrono::year_month_day>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
- return __value.weekday().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
- return __value.weekday().ok();
- else if constexpr (__is_hh_mm_ss<_Tp>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else if constexpr (same_as<_Tp, chrono::sys_info>)
- return true;
- else if constexpr (same_as<_Tp, chrono::local_info>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return true;
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else
- static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) {
- if constexpr (__is_time_point<_Tp>)
- return true;
- else if constexpr (same_as<_Tp, chrono::day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
- return __value.weekday().ok();
- else if constexpr (same_as<_Tp, chrono::weekday_last>)
- return __value.weekday().ok();
- else if constexpr (same_as<_Tp, chrono::month_day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_weekday>)
- return __value.weekday_indexed().ok();
- else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
- return __value.weekday_indexed().ok();
- else if constexpr (same_as<_Tp, chrono::year_month>)
- return true;
- else if constexpr (same_as<_Tp, chrono::year_month_day>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
- return __value.weekday().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
- return __value.weekday().ok();
- else if constexpr (__is_hh_mm_ss<_Tp>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else if constexpr (same_as<_Tp, chrono::sys_info>)
- return true;
- else if constexpr (same_as<_Tp, chrono::local_info>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return true;
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else
- static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) {
- if constexpr (__is_time_point<_Tp>)
- return true;
- else if constexpr (same_as<_Tp, chrono::day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_weekday>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::year_month>)
- return true;
- else if constexpr (same_as<_Tp, chrono::year_month_day>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
- return __value.ok();
- else if constexpr (__is_hh_mm_ss<_Tp>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else if constexpr (same_as<_Tp, chrono::sys_info>)
- return true;
- else if constexpr (same_as<_Tp, chrono::local_info>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return true;
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else
- static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) {
- if constexpr (__is_time_point<_Tp>)
- return true;
- else if constexpr (same_as<_Tp, chrono::day>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month>)
- return __value.ok();
- else if constexpr (same_as<_Tp, chrono::year>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_indexed>)
- return true;
- else if constexpr (same_as<_Tp, chrono::weekday_last>)
- return true;
- else if constexpr (same_as<_Tp, chrono::month_day>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::month_day_last>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::month_weekday>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::month_weekday_last>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::year_month>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_day>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_day_last>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday>)
- return __value.month().ok();
- else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>)
- return __value.month().ok();
- else if constexpr (__is_hh_mm_ss<_Tp>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else if constexpr (same_as<_Tp, chrono::sys_info>)
- return true;
- else if constexpr (same_as<_Tp, chrono::local_info>)
- return true;
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- else if constexpr (__is_specialization_v<_Tp, chrono::zoned_time>)
- return true;
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
- else
- static_assert(sizeof(_Tp) == 0, "Add the missing type specialization");
-}
-
-template <class _CharT, class _Tp, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI auto
-__format_chrono(const _Tp& __value,
- _FormatContext& __ctx,
- __format_spec::__parsed_specifications<_CharT> __specs,
- basic_string_view<_CharT> __chrono_specs) {
- basic_stringstream<_CharT> __sstr;
- // [time.format]/2
- // 2.1 - the "C" locale if the L option is not present in chrono-format-spec, otherwise
- // 2.2 - the locale passed to the formatting function if any, otherwise
- // 2.3 - the global locale.
- // Note that the __ctx's locale() call does 2.2 and 2.3.
- if (__specs.__chrono_.__locale_specific_form_)
- __sstr.imbue(__ctx.locale());
- else
- __sstr.imbue(locale::classic());
-
- if (__chrono_specs.empty())
- __sstr << __value;
- else {
- if constexpr (chrono::__is_duration<_Tp>::value) {
- // A duration can be a user defined arithmetic type. Users may specialize
- // numeric_limits, but they may not specialize is_signed.
- if constexpr (numeric_limits<typename _Tp::rep>::is_signed) {
- if (__value < __value.zero()) {
- __sstr << _CharT('-');
- __formatter::__format_chrono_using_chrono_specs(__sstr, -__value, __chrono_specs);
- } else
- __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
- } else
- __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
- // TODO FMT When keeping the precision it will truncate the string.
- // Note that the behaviour what the precision does isn't specified.
- __specs.__precision_ = -1;
- } else {
- // Test __weekday_name_ before __weekday_ to give a better error.
- if (__specs.__chrono_.__weekday_name_ && !__formatter::__weekday_name_ok(__value))
- std::__throw_format_error("Formatting a weekday name needs a valid weekday");
-
- if (__specs.__chrono_.__weekday_ && !__formatter::__weekday_ok(__value))
- std::__throw_format_error("Formatting a weekday needs a valid weekday");
-
- if (__specs.__chrono_.__day_of_year_ && !__formatter::__date_ok(__value))
- std::__throw_format_error("Formatting a day of year needs a valid date");
-
- if (__specs.__chrono_.__week_of_year_ && !__formatter::__date_ok(__value))
- std::__throw_format_error("Formatting a week of year needs a valid date");
-
- if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value))
- std::__throw_format_error("Formatting a month name from an invalid month number");
-
- if constexpr (__is_hh_mm_ss<_Tp>) {
- // Note this is a pedantic intepretation of the Standard. A hh_mm_ss
- // is no longer a time_of_day and can store an arbitrary number of
- // hours. A number of hours in a 12 or 24 hour clock can't represent
- // 24 hours or more. The functions std::chrono::make12 and
- // std::chrono::make24 reaffirm this view point.
- //
- // Interestingly this will be the only output stream function that
- // throws.
- //
- // TODO FMT The wording probably needs to be adapted to
- // - The displayed hours is hh_mm_ss.hours() % 24
- // - It should probably allow %j in the same fashion as duration.
- // - The stream formatter should change its output when hours >= 24
- // - Write it as not valid,
- // - or write the number of days.
- if (__specs.__chrono_.__hour_ && __value.hours().count() > 23)
- std::__throw_format_error("Formatting a hour needs a valid value");
-
- if (__value.is_negative())
- __sstr << _CharT('-');
- }
-
- __formatter::__format_chrono_using_chrono_specs(__sstr, __value, __chrono_specs);
- }
- }
-
- return __formatter::__write_string(__sstr.view(), __ctx.out(), __specs);
-}
-
-} // namespace __formatter
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_chrono {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator
- __parse(_ParseContext& __ctx, __format_spec::__fields __fields, __format_spec::__flags __flags) {
- return __parser_.__parse(__ctx, __fields, __flags);
- }
-
- template <class _Tp, class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __value, _FormatContext& __ctx) const {
- return __formatter::__format_chrono(
- __value, __ctx, __parser_.__parser_.__get_parsed_chrono_specifications(__ctx), __parser_.__chrono_specs_);
- }
-
- __format_spec::__parser_chrono<_CharT> __parser_;
-};
-
-template <class _Duration, __fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::sys_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
- }
-};
-
-template <class _Duration, __fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::file_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
- }
-};
-
-template <class _Duration, __fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::local_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- // The flags are not __clock since there is no associated time-zone.
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date_time);
- }
-};
-
-template <class _Rep, class _Period, __fmt_char_type _CharT>
-struct formatter<chrono::duration<_Rep, _Period>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- // [time.format]/1
- // Giving a precision specification in the chrono-format-spec is valid only
- // for std::chrono::duration types where the representation type Rep is a
- // floating-point type. For all other Rep types, an exception of type
- // format_error is thrown if the chrono-format-spec contains a precision
- // specification.
- //
- // Note this doesn't refer to chrono::treat_as_floating_point_v<_Rep>.
- if constexpr (std::floating_point<_Rep>)
- return _Base::__parse(__ctx, __format_spec::__fields_chrono_fractional, __format_spec::__flags::__duration);
- else
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__duration);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__day);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__weekday);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_day);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__month_weekday);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__year_month);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__date);
- }
-};
-
-template <class _Duration, __fmt_char_type _CharT>
-struct formatter<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time);
- }
-};
-
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-template <__fmt_char_type _CharT>
-struct formatter<chrono::sys_info, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time_zone);
- }
-};
-
-template <__fmt_char_type _CharT>
-struct formatter<chrono::local_info, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags{});
- }
-};
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-// Note due to how libc++'s formatters are implemented there is no need to add
-// the exposition only local-time-format-t abstraction.
-template <class _Duration, class _TimeZonePtr, __fmt_char_type _CharT>
-struct formatter<chrono::zoned_time<_Duration, _TimeZonePtr>, _CharT> : public __formatter_chrono<_CharT> {
-public:
- using _Base = __formatter_chrono<_CharT>;
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock);
- }
-};
-# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
- // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHRONO_FORMATTER_H
diff --git a/libcxx/include/__cxx03/__chrono/hh_mm_ss.h b/libcxx/include/__cxx03/__chrono/hh_mm_ss.h
deleted file mode 100644
index e40cfa3a58b8d..0000000000000
--- a/libcxx/include/__cxx03/__chrono/hh_mm_ss.h
+++ /dev/null
@@ -1,112 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_HH_MM_SS_H
-#define _LIBCPP___CXX03___CHRONO_HH_MM_SS_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/ratio>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-template <class _Duration>
-class hh_mm_ss {
-private:
- static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
- using __CommonType = common_type_t<_Duration, chrono::seconds>;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr uint64_t __pow10(unsigned __exp) {
- uint64_t __ret = 1;
- for (unsigned __i = 0; __i < __exp; ++__i)
- __ret *= 10U;
- return __ret;
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0) {
- if (__n >= 2 && __d != 0 && __w < 19)
- return 1 + __width(__n, __d % __n * 10, __w + 1);
- return 0;
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI static unsigned constexpr fractional_width =
- __width(__CommonType::period::den) < 19 ? __width(__CommonType::period::den) : 6u;
- using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
-
- _LIBCPP_HIDE_FROM_ABI constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit hh_mm_ss(_Duration __d) noexcept
- : __is_neg_(__d < _Duration(0)),
- __h_(chrono::duration_cast<chrono::hours>(chrono::abs(__d))),
- __m_(chrono::duration_cast<chrono::minutes>(chrono::abs(__d) - hours())),
- __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
- __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
- _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
- auto __dur = __h_ + __m_ + __s_ + __f_;
- return __is_neg_ ? -__dur : __dur;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator precision() const noexcept { return to_duration(); }
-
-private:
- bool __is_neg_;
- chrono::hours __h_;
- chrono::minutes __m_;
- chrono::seconds __s_;
- precision __f_;
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss);
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
- return __h >= hours(0) && __h < hours(12);
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
- return __h >= hours(12) && __h < hours(24);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
- if (__h == hours(0))
- return hours(12);
- else if (__h <= hours(12))
- return __h;
- else
- return __h - hours(12);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
- if (__is_pm)
- return __h == hours(12) ? __h : __h + hours(12);
- else
- return __h == hours(12) ? hours(0) : __h;
-}
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_HH_MM_SS_H
diff --git a/libcxx/include/__cxx03/__chrono/leap_second.h b/libcxx/include/__cxx03/__chrono/leap_second.h
deleted file mode 100644
index d6678bc58d7b1..0000000000000
--- a/libcxx/include/__cxx03/__chrono/leap_second.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_LEAP_SECOND_H
-#define _LIBCPP___CXX03___CHRONO_LEAP_SECOND_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/duration.h>
-# include <__cxx03/__chrono/system_clock.h>
-# include <__cxx03/__chrono/time_point.h>
-# include <__cxx03/__compare/ordering.h>
-# include <__cxx03/__compare/three_way_comparable.h>
-# include <__cxx03/__config>
-# include <__cxx03/__utility/private_constructor_tag.h>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20
-
-namespace chrono {
-
-class leap_second {
-public:
- [[nodiscard]]
- _LIBCPP_HIDE_FROM_ABI explicit constexpr leap_second(__private_constructor_tag, sys_seconds __date, seconds __value)
- : __date_(__date), __value_(__value) {}
-
- _LIBCPP_HIDE_FROM_ABI leap_second(const leap_second&) = default;
- _LIBCPP_HIDE_FROM_ABI leap_second& operator=(const leap_second&) = default;
-
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr sys_seconds date() const noexcept { return __date_; }
-
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI constexpr seconds value() const noexcept { return __value_; }
-
-private:
- sys_seconds __date_;
- seconds __value_;
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const leap_second& __x, const leap_second& __y) {
- return __x.date() == __y.date();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) {
- return __x.date() <=> __y.date();
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) {
- return __x.date() == __y;
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) {
- return __x.date() < __y;
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) {
- return __x < __y.date();
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) {
- return __y < __x;
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) {
- return __y < __x;
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) {
- return !(__y < __x);
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) {
- return !(__y < __x);
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) {
- return !(__x < __y);
-}
-
-template <class _Duration>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) {
- return !(__x < __y);
-}
-
-# ifndef _LIBCPP_COMPILER_GCC
-// This requirement cause a compilation loop in GCC-13 and running out of memory.
-// TODO TZDB Test whether GCC-14 fixes this.
-template <class _Duration>
- requires three_way_comparable_with<sys_seconds, sys_time<_Duration>>
-_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) {
- return __x.date() <=> __y;
-}
-# endif
-
-} // namespace chrono
-
-# endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_LEAP_SECOND_H
diff --git a/libcxx/include/__cxx03/__chrono/literals.h b/libcxx/include/__cxx03/__chrono/literals.h
deleted file mode 100644
index 6d0f596aa4ce5..0000000000000
--- a/libcxx/include/__cxx03/__chrono/literals.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_LITERALS_H
-#define _LIBCPP___CXX03___CHRONO_LITERALS_H
-
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-inline namespace literals {
-inline namespace chrono_literals {
-_LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
- return chrono::day(static_cast<unsigned>(__d));
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
- return chrono::year(static_cast<int>(__y));
-}
-} // namespace chrono_literals
-} // namespace literals
-
-namespace chrono { // hoist the literals into namespace std::chrono
-using namespace literals::chrono_literals;
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_LITERALS_H
diff --git a/libcxx/include/__cxx03/__chrono/local_info.h b/libcxx/include/__cxx03/__chrono/local_info.h
deleted file mode 100644
index 1c475ec93c167..0000000000000
--- a/libcxx/include/__cxx03/__chrono/local_info.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_LOCAL_INFO_H
-#define _LIBCPP___CXX03___CHRONO_LOCAL_INFO_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/sys_info.h>
-# include <__cxx03/__config>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20
-
-namespace chrono {
-
-struct local_info {
- static constexpr int unique = 0;
- static constexpr int nonexistent = 1;
- static constexpr int ambiguous = 2;
-
- int result;
- sys_info first;
- sys_info second;
-};
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_LOCAL_INFO_H
diff --git a/libcxx/include/__cxx03/__chrono/month.h b/libcxx/include/__cxx03/__chrono/month.h
deleted file mode 100644
index 9ccc85991af71..0000000000000
--- a/libcxx/include/__cxx03/__chrono/month.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_MONTH_H
-#define _LIBCPP___CXX03___CHRONO_MONTH_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class month {
-private:
- unsigned char __m_;
-
-public:
- month() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr month(unsigned __val) noexcept
- : __m_(static_cast<unsigned char>(__val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator++() noexcept {
- *this += months{1};
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator++(int) noexcept {
- month __tmp = *this;
- ++(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month& operator--() noexcept {
- *this -= months{1};
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr month operator--(int) noexcept {
- month __tmp = *this;
- --(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month& __lhs, const month& __rhs) noexcept {
- return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
- auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
- auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
- return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
- auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
- return months(__dm <= 11 ? __dm : __dm + 12);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month& month::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-
-inline constexpr month January{1};
-inline constexpr month February{2};
-inline constexpr month March{3};
-inline constexpr month April{4};
-inline constexpr month May{5};
-inline constexpr month June{6};
-inline constexpr month July{7};
-inline constexpr month August{8};
-inline constexpr month September{9};
-inline constexpr month October{10};
-inline constexpr month November{11};
-inline constexpr month December{12};
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_MONTH_H
diff --git a/libcxx/include/__cxx03/__chrono/month_weekday.h b/libcxx/include/__cxx03/__chrono/month_weekday.h
deleted file mode 100644
index eedc6e9a784bb..0000000000000
--- a/libcxx/include/__cxx03/__chrono/month_weekday.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_MONTH_WEEKDAY_H
-#define _LIBCPP___CXX03___CHRONO_MONTH_WEEKDAY_H
-
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/weekday.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class month_weekday {
-private:
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
- const chrono::weekday_indexed& __wdival) noexcept
- : __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
- return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
-operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
- return month_weekday{__lhs, __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
- return month_weekday{month(__lhs), __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
-operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
- return month_weekday{__rhs, __lhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
- return month_weekday{month(__rhs), __lhs};
-}
-
-class month_weekday_last {
- chrono::month __m_;
- chrono::weekday_last __wdl_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
- const chrono::weekday_last& __wdlval) noexcept
- : __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {
- return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
-operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
- return month_weekday_last{__lhs, __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {
- return month_weekday_last{month(__lhs), __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
-operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
- return month_weekday_last{__rhs, __lhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {
- return month_weekday_last{month(__rhs), __lhs};
-}
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_MONTH_WEEKDAY_H
diff --git a/libcxx/include/__cxx03/__chrono/monthday.h b/libcxx/include/__cxx03/__chrono/monthday.h
deleted file mode 100644
index a64584ee2e5f9..0000000000000
--- a/libcxx/include/__cxx03/__chrono/monthday.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_MONTHDAY_H
-#define _LIBCPP___CXX03___CHRONO_MONTHDAY_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class month_day {
-private:
- chrono::month __m_;
- chrono::day __d_;
-
-public:
- month_day() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept {
- if (!__m_.ok())
- return false;
- const unsigned __dval = static_cast<unsigned>(__d_);
- if (__dval < 1 || __dval > 31)
- return false;
- if (__dval <= 29)
- return true;
- // Now we've got either 30 or 31
- const unsigned __mval = static_cast<unsigned>(__m_);
- if (__mval == 2)
- return false;
- if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11)
- return __dval == 30;
- return true;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept {
- return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
-operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, const day& __rhs) noexcept {
- return month_day{__lhs, __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, const month& __rhs) noexcept {
- return __rhs / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
- return __lhs / day(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
- return month(__lhs) / __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
- return month(__rhs) / __lhs;
-}
-
-class month_day_last {
-private:
- chrono::month __m_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
- return __lhs.month() == __rhs.month();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
-operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
- return __lhs.month() <=> __rhs.month();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
- return month_day_last{__lhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
- return month_day_last{__rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
- return month_day_last{month(__lhs)};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
- return month_day_last{month(__rhs)};
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_MONTHDAY_H
diff --git a/libcxx/include/__cxx03/__chrono/ostream.h b/libcxx/include/__cxx03/__chrono/ostream.h
deleted file mode 100644
index fed43890c39b7..0000000000000
--- a/libcxx/include/__cxx03/__chrono/ostream.h
+++ /dev/null
@@ -1,322 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_OSTREAM_H
-#define _LIBCPP___CXX03___CHRONO_OSTREAM_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/file_clock.h>
-#include <__cxx03/__chrono/hh_mm_ss.h>
-#include <__cxx03/__chrono/local_info.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/month_weekday.h>
-#include <__cxx03/__chrono/monthday.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__chrono/sys_info.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/weekday.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__chrono/year_month.h>
-#include <__cxx03/__chrono/year_month_day.h>
-#include <__cxx03/__chrono/year_month_weekday.h>
-#include <__cxx03/__chrono/zoned_time.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_functions.h>
-#include <__cxx03/__fwd/ostream.h>
-#include <__cxx03/ratio>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace chrono {
-
-template <class _CharT, class _Traits, class _Duration>
- requires(!treat_as_floating_point_v<typename _Duration::rep> && _Duration{1} < days{1})
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration>& __tp) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_days& __dp) {
- return __os << year_month_day{__dp};
-}
-
-template <class _CharT, class _Traits, class _Duration>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const file_time<_Duration> __tp) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
-}
-
-template <class _CharT, class _Traits, class _Duration>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const local_time<_Duration> __tp) {
- return __os << sys_time<_Duration>{__tp.time_since_epoch()};
-}
-
-// Depending on the type the return is a const _CharT* or a basic_string<_CharT>
-template <class _CharT, class _Period>
-_LIBCPP_HIDE_FROM_ABI auto __units_suffix() {
- // TODO FMT LWG issue the suffixes are always char and not STATICALLY-WIDEN'ed.
- if constexpr (same_as<typename _Period::type, atto>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "as");
- else if constexpr (same_as<typename _Period::type, femto>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "fs");
- else if constexpr (same_as<typename _Period::type, pico>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ps");
- else if constexpr (same_as<typename _Period::type, nano>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ns");
- else if constexpr (same_as<typename _Period::type, micro>)
-# ifndef _LIBCPP_HAS_NO_UNICODE
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "\u00b5s");
-# else
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "us");
-# endif
- else if constexpr (same_as<typename _Period::type, milli>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ms");
- else if constexpr (same_as<typename _Period::type, centi>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "cs");
- else if constexpr (same_as<typename _Period::type, deci>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ds");
- else if constexpr (same_as<typename _Period::type, ratio<1>>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "s");
- else if constexpr (same_as<typename _Period::type, deca>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "das");
- else if constexpr (same_as<typename _Period::type, hecto>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "hs");
- else if constexpr (same_as<typename _Period::type, kilo>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ks");
- else if constexpr (same_as<typename _Period::type, mega>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ms");
- else if constexpr (same_as<typename _Period::type, giga>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "Gs");
- else if constexpr (same_as<typename _Period::type, tera>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ts");
- else if constexpr (same_as<typename _Period::type, peta>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "Ps");
- else if constexpr (same_as<typename _Period::type, exa>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "Es");
- else if constexpr (same_as<typename _Period::type, ratio<60>>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "min");
- else if constexpr (same_as<typename _Period::type, ratio<3600>>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "h");
- else if constexpr (same_as<typename _Period::type, ratio<86400>>)
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "d");
- else if constexpr (_Period::den == 1)
- return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}]s"), _Period::num);
- else
- return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "[{}/{}]s"), _Period::num, _Period::den);
-}
-
-template <class _CharT, class _Traits, class _Rep, class _Period>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d) {
- basic_ostringstream<_CharT, _Traits> __s;
- __s.flags(__os.flags());
- __s.imbue(__os.getloc());
- __s.precision(__os.precision());
- __s << __d.count() << chrono::__units_suffix<_CharT, _Period>();
- return __os << __s.str();
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const day& __d) {
- return __os << (__d.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%d}"), __d)
- // Note this error differs from the wording of the Standard. The
- // Standard wording doesn't work well on AIX or Windows. There
- // the formatted day seems to be either modulo 100 or completely
- // omitted. Judging by the wording this is valid.
- // TODO FMT Write a paper of file an LWG issue.
- : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02} is not a valid day"),
- static_cast<unsigned>(__d)));
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const month& __m) {
- return __os << (__m.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%b}"), __m)
- : std::format(__os.getloc(),
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid month"),
- static_cast<unsigned>(__m))); // TODO FMT Standard mandated locale isn't used.
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year& __y) {
- return __os << (__y.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y}"), __y)
- : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y} is not a valid year"), __y));
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday& __wd) {
- return __os << (__wd.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%a}"), __wd)
- : std::format(__os.getloc(), // TODO FMT Standard mandated locale isn't used.
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{} is not a valid weekday"),
- static_cast<unsigned>(__wd.c_encoding())));
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_indexed& __wdi) {
- auto __i = __wdi.index();
- return __os << (__i >= 1 && __i <= 5
- ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{}]"), __wdi.weekday(), __i)
- : std::format(__os.getloc(),
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[{} is not a valid index]"),
- __wdi.weekday(),
- __i));
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_last& __wdl) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[last]"), __wdl.weekday());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day& __md) {
- // TODO FMT The Standard allows 30th of February to be printed.
- // It would be nice to show an error message instead.
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{}"), __md.month(), __md.day());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day_last& __mdl) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/last"), __mdl.month());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday& __mwd) {
- return __os << std::format(
- __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwd.month(), __mwd.weekday_indexed());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday_last& __mwdl) {
- return __os << std::format(
- __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwdl.month(), __mwdl.weekday_last());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month& __ym) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ym.year(), __ym.month());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day& __ymd) {
- return __os << (__ymd.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F}"), __ymd)
- : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F} is not a valid date"), __ymd));
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day_last& __ymdl) {
- return __os << std::format(
- __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ymdl.year(), __ymdl.month_day_last());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday& __ymwd) {
- return __os << std::format(
- __os.getloc(),
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"),
- __ymwd.year(),
- __ymwd.month(),
- __ymwd.weekday_indexed());
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday_last& __ymwdl) {
- return __os << std::format(
- __os.getloc(),
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}/{:L}"),
- __ymwdl.year(),
- __ymwdl.month(),
- __ymwdl.weekday_last());
-}
-
-template <class _CharT, class _Traits, class _Duration>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms);
-}
-
-# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_info& __info) {
- // __info.abbrev is always std::basic_string<char>.
- // Since these strings typically are short the conversion should be cheap.
- std::basic_string<_CharT> __abbrev{__info.abbrev.begin(), __info.abbrev.end()};
- return __os << std::format(
- _LIBCPP_STATICALLY_WIDEN(_CharT, "[{:%F %T}, {:%F %T}) {:%T} {:%Q%q} \"{}\""),
- __info.begin,
- __info.end,
- hh_mm_ss{__info.offset},
- __info.save,
- __abbrev);
-}
-
-template <class _CharT, class _Traits>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const local_info& __info) {
- auto __result = [&]() -> basic_string<_CharT> {
- switch (__info.result) {
- case local_info::unique:
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "unique");
- case local_info::nonexistent:
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "non-existent");
- case local_info::ambiguous:
- return _LIBCPP_STATICALLY_WIDEN(_CharT, "ambiguous");
-
- default:
- return std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "unspecified result ({})"), __info.result);
- };
- };
-
- return __os << std::format(
- _LIBCPP_STATICALLY_WIDEN(_CharT, "{}: {{{}, {}}}"), __result(), __info.first, __info.second);
-}
-
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template <class _CharT, class _Traits, class _Duration, class _TimeZonePtr>
-_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const zoned_time<_Duration, _TimeZonePtr>& __tp) {
- return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T %Z}"), __tp);
-}
-# endif
-# endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-} // namespace chrono
-
-#endif // if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHRONO_OSTREAM_H
diff --git a/libcxx/include/__cxx03/__chrono/parser_std_format_spec.h b/libcxx/include/__cxx03/__chrono/parser_std_format_spec.h
deleted file mode 100644
index 2bec77d8c74dd..0000000000000
--- a/libcxx/include/__cxx03/__chrono/parser_std_format_spec.h
+++ /dev/null
@@ -1,416 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_PARSER_STD_FORMAT_SPEC_H
-#define _LIBCPP___CXX03___CHRONO_PARSER_STD_FORMAT_SPEC_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter_string.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format_spec {
-
-// By not placing this constant in the formatter class it's not duplicated for char and wchar_t
-inline constexpr __fields __fields_chrono_fractional{
- .__precision_ = true, .__locale_specific_form_ = true, .__type_ = false};
-inline constexpr __fields __fields_chrono{.__locale_specific_form_ = true, .__type_ = false};
-
-/// Flags available or required in a chrono type.
-///
-/// The caller of the chrono formatter lists the types it has available and the
-/// validation tests whether the requested type spec (e.g. %M) is available in
-/// the formatter.
-/// When the type in the chrono-format-spec isn't present in the data a
-/// \ref format_error is thrown.
-enum class __flags {
- __second = 0x1,
- __minute = 0x2,
- __hour = 0x4,
- __time = __hour | __minute | __second,
-
- __day = 0x8,
- __month = 0x10,
- __year = 0x20,
-
- __weekday = 0x40,
-
- __month_day = __day | __month,
- __month_weekday = __weekday | __month,
- __year_month = __month | __year,
- __date = __day | __month | __year | __weekday,
-
- __date_time = __date | __time,
-
- __duration = 0x80 | __time,
-
- __time_zone = 0x100,
-
- __clock = __date_time | __time_zone
-};
-
-_LIBCPP_HIDE_FROM_ABI constexpr __flags operator&(__flags __lhs, __flags __rhs) {
- return static_cast<__flags>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_second(__flags __flags) {
- if ((__flags & __flags::__second) != __flags::__second)
- std::__throw_format_error("The supplied date time doesn't contain a second");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_minute(__flags __flags) {
- if ((__flags & __flags::__minute) != __flags::__minute)
- std::__throw_format_error("The supplied date time doesn't contain a minute");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_hour(__flags __flags) {
- if ((__flags & __flags::__hour) != __flags::__hour)
- std::__throw_format_error("The supplied date time doesn't contain an hour");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_time(__flags __flags) {
- if ((__flags & __flags::__time) != __flags::__time)
- std::__throw_format_error("The supplied date time doesn't contain a time");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_day(__flags __flags) {
- if ((__flags & __flags::__day) != __flags::__day)
- std::__throw_format_error("The supplied date time doesn't contain a day");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_month(__flags __flags) {
- if ((__flags & __flags::__month) != __flags::__month)
- std::__throw_format_error("The supplied date time doesn't contain a month");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_year(__flags __flags) {
- if ((__flags & __flags::__year) != __flags::__year)
- std::__throw_format_error("The supplied date time doesn't contain a year");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date(__flags __flags) {
- if ((__flags & __flags::__date) != __flags::__date)
- std::__throw_format_error("The supplied date time doesn't contain a date");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_or_duration(__flags __flags) {
- if (((__flags & __flags::__date) != __flags::__date) && ((__flags & __flags::__duration) != __flags::__duration))
- std::__throw_format_error("The supplied date time doesn't contain a date or duration");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_date_time(__flags __flags) {
- if ((__flags & __flags::__date_time) != __flags::__date_time)
- std::__throw_format_error("The supplied date time doesn't contain a date and time");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_weekday(__flags __flags) {
- if ((__flags & __flags::__weekday) != __flags::__weekday)
- std::__throw_format_error("The supplied date time doesn't contain a weekday");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_duration(__flags __flags) {
- if ((__flags & __flags::__duration) != __flags::__duration)
- std::__throw_format_error("The supplied date time doesn't contain a duration");
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __validate_time_zone(__flags __flags) {
- if ((__flags & __flags::__time_zone) != __flags::__time_zone)
- std::__throw_format_error("The supplied date time doesn't contain a time zone");
-}
-
-template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __parser_chrono {
- using _ConstIterator = typename basic_format_parse_context<_CharT>::const_iterator;
-
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator
- __parse(_ParseContext& __ctx, __fields __fields, __flags __flags) {
- _ConstIterator __begin = __parser_.__parse(__ctx, __fields);
- _ConstIterator __end = __ctx.end();
- if (__begin == __end)
- return __begin;
-
- _ConstIterator __last = __parse_chrono_specs(__begin, __end, __flags);
- __chrono_specs_ = basic_string_view<_CharT>{__begin, __last};
-
- return __last;
- }
-
- __parser<_CharT> __parser_;
- basic_string_view<_CharT> __chrono_specs_;
-
-private:
- _LIBCPP_HIDE_FROM_ABI constexpr _ConstIterator
- __parse_chrono_specs(_ConstIterator __begin, _ConstIterator __end, __flags __flags) {
- _LIBCPP_ASSERT_INTERNAL(__begin != __end,
- "When called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
-
- if (*__begin != _CharT('%') && *__begin != _CharT('}'))
- std::__throw_format_error("The format specifier expects a '%' or a '}'");
-
- do {
- switch (*__begin) {
- case _CharT('{'):
- std::__throw_format_error("The chrono specifiers contain a '{'");
-
- case _CharT('}'):
- return __begin;
-
- case _CharT('%'):
- __parse_conversion_spec(__begin, __end, __flags);
- [[fallthrough]];
-
- default:
- // All other literals
- ++__begin;
- }
-
- } while (__begin != __end && *__begin != _CharT('}'));
-
- return __begin;
- }
-
- /// \pre *__begin == '%'
- /// \post __begin points at the end parsed conversion-spec
- _LIBCPP_HIDE_FROM_ABI constexpr void
- __parse_conversion_spec(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
- ++__begin;
- if (__begin == __end)
- std::__throw_format_error("End of input while parsing a conversion specifier");
-
- switch (*__begin) {
- case _CharT('n'):
- case _CharT('t'):
- case _CharT('%'):
- break;
-
- case _CharT('S'):
- __format_spec::__validate_second(__flags);
- break;
-
- case _CharT('M'):
- __format_spec::__validate_minute(__flags);
- break;
-
- case _CharT('p'): // TODO FMT does the formater require an hour or a time?
- case _CharT('H'):
- case _CharT('I'):
- __parser_.__hour_ = true;
- __validate_hour(__flags);
- break;
-
- case _CharT('r'):
- case _CharT('R'):
- case _CharT('T'):
- case _CharT('X'):
- __parser_.__hour_ = true;
- __format_spec::__validate_time(__flags);
- break;
-
- case _CharT('d'):
- case _CharT('e'):
- __format_spec::__validate_day(__flags);
- break;
-
- case _CharT('b'):
- case _CharT('h'):
- case _CharT('B'):
- __parser_.__month_name_ = true;
- [[fallthrough]];
- case _CharT('m'):
- __format_spec::__validate_month(__flags);
- break;
-
- case _CharT('y'):
- case _CharT('C'):
- case _CharT('Y'):
- __format_spec::__validate_year(__flags);
- break;
-
- case _CharT('j'):
- __parser_.__day_of_year_ = true;
- __format_spec::__validate_date_or_duration(__flags);
- break;
-
- case _CharT('g'):
- case _CharT('G'):
- case _CharT('U'):
- case _CharT('V'):
- case _CharT('W'):
- __parser_.__week_of_year_ = true;
- [[fallthrough]];
- case _CharT('x'):
- case _CharT('D'):
- case _CharT('F'):
- __format_spec::__validate_date(__flags);
- break;
-
- case _CharT('c'):
- __format_spec::__validate_date_time(__flags);
- break;
-
- case _CharT('a'):
- case _CharT('A'):
- __parser_.__weekday_name_ = true;
- [[fallthrough]];
- case _CharT('u'):
- case _CharT('w'):
- __parser_.__weekday_ = true;
- __validate_weekday(__flags);
- __format_spec::__validate_weekday(__flags);
- break;
-
- case _CharT('q'):
- case _CharT('Q'):
- __format_spec::__validate_duration(__flags);
- break;
-
- case _CharT('E'):
- __parse_modifier_E(__begin, __end, __flags);
- break;
-
- case _CharT('O'):
- __parse_modifier_O(__begin, __end, __flags);
- break;
-
- case _CharT('z'):
- case _CharT('Z'):
- // Currently there's no time zone information. However some clocks have a
- // hard-coded "time zone", for these clocks the information can be used.
- // TODO FMT implement time zones.
- __format_spec::__validate_time_zone(__flags);
- break;
-
- default: // unknown type;
- std::__throw_format_error("The date time type specifier is invalid");
- }
- }
-
- /// \pre *__begin == 'E'
- /// \post __begin is incremented by one.
- _LIBCPP_HIDE_FROM_ABI constexpr void
- __parse_modifier_E(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
- ++__begin;
- if (__begin == __end)
- std::__throw_format_error("End of input while parsing the modifier E");
-
- switch (*__begin) {
- case _CharT('X'):
- __parser_.__hour_ = true;
- __format_spec::__validate_time(__flags);
- break;
-
- case _CharT('y'):
- case _CharT('C'):
- case _CharT('Y'):
- __format_spec::__validate_year(__flags);
- break;
-
- case _CharT('x'):
- __format_spec::__validate_date(__flags);
- break;
-
- case _CharT('c'):
- __format_spec::__validate_date_time(__flags);
- break;
-
- case _CharT('z'):
- // Currently there's no time zone information. However some clocks have a
- // hard-coded "time zone", for these clocks the information can be used.
- // TODO FMT implement time zones.
- __format_spec::__validate_time_zone(__flags);
- break;
-
- default:
- std::__throw_format_error("The date time type specifier for modifier E is invalid");
- }
- }
-
- /// \pre *__begin == 'O'
- /// \post __begin is incremented by one.
- _LIBCPP_HIDE_FROM_ABI constexpr void
- __parse_modifier_O(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
- ++__begin;
- if (__begin == __end)
- std::__throw_format_error("End of input while parsing the modifier O");
-
- switch (*__begin) {
- case _CharT('S'):
- __format_spec::__validate_second(__flags);
- break;
-
- case _CharT('M'):
- __format_spec::__validate_minute(__flags);
- break;
-
- case _CharT('I'):
- case _CharT('H'):
- __parser_.__hour_ = true;
- __format_spec::__validate_hour(__flags);
- break;
-
- case _CharT('d'):
- case _CharT('e'):
- __format_spec::__validate_day(__flags);
- break;
-
- case _CharT('m'):
- __format_spec::__validate_month(__flags);
- break;
-
- case _CharT('y'):
- __format_spec::__validate_year(__flags);
- break;
-
- case _CharT('U'):
- case _CharT('V'):
- case _CharT('W'):
- __parser_.__week_of_year_ = true;
- __format_spec::__validate_date(__flags);
- break;
-
- case _CharT('u'):
- case _CharT('w'):
- __parser_.__weekday_ = true;
- __format_spec::__validate_weekday(__flags);
- break;
-
- case _CharT('z'):
- // Currently there's no time zone information. However some clocks have a
- // hard-coded "time zone", for these clocks the information can be used.
- // TODO FMT implement time zones.
- __format_spec::__validate_time_zone(__flags);
- break;
-
- default:
- std::__throw_format_error("The date time type specifier for modifier O is invalid");
- }
- }
-};
-
-} // namespace __format_spec
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHRONO_PARSER_STD_FORMAT_SPEC_H
diff --git a/libcxx/include/__cxx03/__chrono/statically_widen.h b/libcxx/include/__cxx03/__chrono/statically_widen.h
deleted file mode 100644
index 183078152f61c..0000000000000
--- a/libcxx/include/__cxx03/__chrono/statically_widen.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_STATICALLY_WIDEN_H
-#define _LIBCPP___CXX03___CHRONO_STATICALLY_WIDEN_H
-
-// Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2)
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {
- if constexpr (same_as<_CharT, char>)
- return __str;
- else
- return __wstr;
-}
-# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)
-# else // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-// Without this indirection the unit test test/libcxx/modules_include.sh.cpp
-// fails for the CI build "No wide characters". This seems like a bug.
-// TODO FMT investigate why this is needed.
-template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) {
- return __str;
-}
-# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CHRONO_STATICALLY_WIDEN_H
diff --git a/libcxx/include/__cxx03/__chrono/sys_info.h b/libcxx/include/__cxx03/__chrono/sys_info.h
deleted file mode 100644
index 45c230de91cc1..0000000000000
--- a/libcxx/include/__cxx03/__chrono/sys_info.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_SYS_INFO_H
-#define _LIBCPP___CXX03___CHRONO_SYS_INFO_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/duration.h>
-# include <__cxx03/__chrono/system_clock.h>
-# include <__cxx03/__chrono/time_point.h>
-# include <__cxx03/__config>
-# include <__cxx03/string>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20
-
-namespace chrono {
-
-struct sys_info {
- sys_seconds begin;
- sys_seconds end;
- seconds offset;
- minutes save;
- string abbrev;
-};
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_SYS_INFO_H
diff --git a/libcxx/include/__cxx03/__chrono/time_point.h b/libcxx/include/__cxx03/__chrono/time_point.h
index 8703275a75ea7..a7efb367807c7 100644
--- a/libcxx/include/__cxx03/__chrono/time_point.h
+++ b/libcxx/include/__cxx03/__chrono/time_point.h
@@ -11,8 +11,6 @@
#define _LIBCPP___CXX03___CHRONO_TIME_POINT_H
#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/three_way_comparable.h>
#include <__cxx03/__config>
#include <__cxx03/__type_traits/common_type.h>
#include <__cxx03/__type_traits/enable_if.h>
diff --git a/libcxx/include/__cxx03/__chrono/time_zone.h b/libcxx/include/__cxx03/__chrono/time_zone.h
deleted file mode 100644
index a49e9023c0a6a..0000000000000
--- a/libcxx/include/__cxx03/__chrono/time_zone.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_TIME_ZONE_H
-#define _LIBCPP___CXX03___CHRONO_TIME_ZONE_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/calendar.h>
-# include <__cxx03/__chrono/duration.h>
-# include <__cxx03/__chrono/exception.h>
-# include <__cxx03/__chrono/local_info.h>
-# include <__cxx03/__chrono/sys_info.h>
-# include <__cxx03/__chrono/system_clock.h>
-# include <__cxx03/__compare/strong_order.h>
-# include <__cxx03/__config>
-# include <__cxx03/__memory/unique_ptr.h>
-# include <__cxx03/__type_traits/common_type.h>
-# include <__cxx03/string_view>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-namespace chrono {
-
-enum class choose { earliest, latest };
-
-class _LIBCPP_AVAILABILITY_TZDB time_zone {
- _LIBCPP_HIDE_FROM_ABI time_zone() = default;
-
-public:
- class __impl; // public so it can be used by make_unique.
-
- // The "constructor".
- //
- // The default constructor is private to avoid the constructor from being
- // part of the ABI. Instead use an __ugly_named function as an ABI interface,
- // since that gives us the ability to change it in the future.
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static time_zone __create(unique_ptr<__impl>&& __p);
-
- _LIBCPP_EXPORTED_FROM_ABI ~time_zone();
-
- _LIBCPP_HIDE_FROM_ABI time_zone(time_zone&&) = default;
- _LIBCPP_HIDE_FROM_ABI time_zone& operator=(time_zone&&) = default;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name(); }
-
- template <class _Duration>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_info get_info(const sys_time<_Duration>& __time) const {
- return __get_info(chrono::time_point_cast<seconds>(__time));
- }
-
- template <class _Duration>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_info get_info(const local_time<_Duration>& __time) const {
- return __get_info(chrono::time_point_cast<seconds>(__time));
- }
-
- // We don't apply nodiscard here since this function throws on many inputs,
- // so it could be used as a validation.
- template <class _Duration>
- _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>> to_sys(const local_time<_Duration>& __time) const {
- local_info __info = get_info(__time);
- switch (__info.result) {
- case local_info::unique:
- return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
-
- case local_info::nonexistent:
- chrono::__throw_nonexistent_local_time(__time, __info);
-
- case local_info::ambiguous:
- chrono::__throw_ambiguous_local_time(__time, __info);
- }
-
- // TODO TZDB The Standard does not specify anything in these cases.
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
-
- return {};
- }
-
- template <class _Duration>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>>
- to_sys(const local_time<_Duration>& __time, choose __z) const {
- local_info __info = get_info(__time);
- switch (__info.result) {
- case local_info::unique:
- case local_info::nonexistent: // first and second are the same
- return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
-
- case local_info::ambiguous:
- switch (__z) {
- case choose::earliest:
- return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
-
- case choose::latest:
- return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.second.offset};
-
- // Note a value out of bounds is not specified.
- }
- }
-
- // TODO TZDB The standard does not specify anything in these cases.
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
-
- return {};
- }
-
- template <class _Duration>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<common_type_t<_Duration, seconds>>
- to_local(const sys_time<_Duration>& __time) const {
- using _Dp = common_type_t<_Duration, seconds>;
-
- sys_info __info = get_info(__time);
-
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.offset >= chrono::seconds{0} || __time.time_since_epoch() >= _Dp::min() - __info.offset,
- "cannot convert the system time; it would be before the minimum local clock value");
-
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __info.offset <= chrono::seconds{0} || __time.time_since_epoch() <= _Dp::max() - __info.offset,
- "cannot convert the system time; it would be after the maximum local clock value");
-
- return local_time<_Dp>{__time.time_since_epoch() + __info.offset};
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
-
-private:
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI string_view __name() const noexcept;
-
- [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI sys_info __get_info(sys_seconds __time) const;
- [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI local_info __get_info(local_seconds __time) const;
-
- unique_ptr<__impl> __impl_;
-};
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool
-operator==(const time_zone& __x, const time_zone& __y) noexcept {
- return __x.name() == __y.name();
-}
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering
-operator<=>(const time_zone& __x, const time_zone& __y) noexcept {
- return __x.name() <=> __y.name();
-}
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
- // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_TIME_ZONE_H
diff --git a/libcxx/include/__cxx03/__chrono/time_zone_link.h b/libcxx/include/__cxx03/__chrono/time_zone_link.h
deleted file mode 100644
index f97851bcd9811..0000000000000
--- a/libcxx/include/__cxx03/__chrono/time_zone_link.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_TIME_ZONE_LINK_H
-#define _LIBCPP___CXX03___CHRONO_TIME_ZONE_LINK_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__compare/strong_order.h>
-# include <__cxx03/__config>
-# include <__cxx03/__utility/private_constructor_tag.h>
-# include <__cxx03/string>
-# include <__cxx03/string_view>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-namespace chrono {
-
-class time_zone_link {
-public:
- [[nodiscard]]
- _LIBCPP_HIDE_FROM_ABI explicit time_zone_link(__private_constructor_tag, string_view __name, string_view __target)
- : __name_{__name}, __target_{__target} {}
-
- _LIBCPP_HIDE_FROM_ABI time_zone_link(time_zone_link&&) = default;
- _LIBCPP_HIDE_FROM_ABI time_zone_link& operator=(time_zone_link&&) = default;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view name() const noexcept { return __name_; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI string_view target() const noexcept { return __target_; }
-
-private:
- string __name_;
- // TODO TZDB instead of the name we can store the pointer to a zone. These
- // pointers are immutable. This makes it possible to directly return a
- // pointer in the time_zone in the 'locate_zone' function.
- string __target_;
-};
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline bool
-operator==(const time_zone_link& __x, const time_zone_link& __y) noexcept {
- return __x.name() == __y.name();
-}
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline strong_ordering
-operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept {
- return __x.name() <=> __y.name();
-}
-
-} // namespace chrono
-
-# endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_TIME_ZONE_LINK_H
diff --git a/libcxx/include/__cxx03/__chrono/tzdb.h b/libcxx/include/__cxx03/__chrono/tzdb.h
deleted file mode 100644
index 69cd19042c35a..0000000000000
--- a/libcxx/include/__cxx03/__chrono/tzdb.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_TZDB_H
-#define _LIBCPP___CXX03___CHRONO_TZDB_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__algorithm/ranges_lower_bound.h>
-# include <__cxx03/__chrono/leap_second.h>
-# include <__cxx03/__chrono/time_zone.h>
-# include <__cxx03/__chrono/time_zone_link.h>
-# include <__cxx03/__config>
-# include <__cxx03/string>
-# include <__cxx03/vector>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-namespace chrono {
-
-struct tzdb {
- string version;
- vector<time_zone> zones;
- vector<time_zone_link> links;
-
- vector<leap_second> leap_seconds;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* __locate_zone(string_view __name) const {
- if (const time_zone* __result = __find_in_zone(__name))
- return __result;
-
- if (auto __it = ranges::lower_bound(links, __name, {}, &time_zone_link::name);
- __it != links.end() && __it->name() == __name)
- if (const time_zone* __result = __find_in_zone(__it->target()))
- return __result;
-
- return nullptr;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* locate_zone(string_view __name) const {
- if (const time_zone* __result = __locate_zone(__name))
- return __result;
-
- std::__throw_runtime_error("tzdb: requested time zone not found");
- }
-
- [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI const time_zone* current_zone() const {
- return __current_zone();
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI const time_zone* __find_in_zone(string_view __name) const noexcept {
- if (auto __it = ranges::lower_bound(zones, __name, {}, &time_zone::name);
- __it != zones.end() && __it->name() == __name)
- return std::addressof(*__it);
-
- return nullptr;
- }
-
- [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const time_zone* __current_zone() const;
-};
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
- // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_TZDB_H
diff --git a/libcxx/include/__cxx03/__chrono/tzdb_list.h b/libcxx/include/__cxx03/__chrono/tzdb_list.h
deleted file mode 100644
index e3fb2a01161a5..0000000000000
--- a/libcxx/include/__cxx03/__chrono/tzdb_list.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_TZDB_LIST_H
-#define _LIBCPP___CXX03___CHRONO_TZDB_LIST_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/time_zone.h>
-# include <__cxx03/__chrono/tzdb.h>
-# include <__cxx03/__config>
-# include <__cxx03/__fwd/string.h>
-# include <__cxx03/forward_list>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-namespace chrono {
-
-// TODO TZDB
-// Libc++ recently switched to only export __ugly_names from the dylib.
-// Since the library is still experimental the functions in this header
-// should be adapted to this new style. The other tzdb headers should be
-// evaluated too.
-
-class _LIBCPP_AVAILABILITY_TZDB tzdb_list {
-public:
- class __impl; // public to allow construction in dylib
- _LIBCPP_HIDE_FROM_ABI explicit tzdb_list(__impl* __p) : __impl_(__p) {
- _LIBCPP_ASSERT_NON_NULL(__impl_ != nullptr, "initialized time_zone without a valid pimpl object");
- }
- _LIBCPP_EXPORTED_FROM_ABI ~tzdb_list();
-
- tzdb_list(const tzdb_list&) = delete;
- tzdb_list& operator=(const tzdb_list&) = delete;
-
- using const_iterator = forward_list<tzdb>::const_iterator;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const tzdb& front() const noexcept { return __front(); }
-
- _LIBCPP_HIDE_FROM_ABI const_iterator erase_after(const_iterator __p) { return __erase_after(__p); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept { return __begin(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept { return __end(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return __cbegin(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return __cend(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __impl& __implementation() { return *__impl_; }
-
-private:
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const tzdb& __front() const noexcept;
-
- _LIBCPP_EXPORTED_FROM_ABI const_iterator __erase_after(const_iterator __p);
-
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __begin() const noexcept;
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __end() const noexcept;
-
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cbegin() const noexcept;
- [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cend() const noexcept;
-
- __impl* __impl_;
-};
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list();
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const tzdb& get_tzdb() {
- return get_tzdb_list().front();
-}
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* locate_zone(string_view __name) {
- return get_tzdb().locate_zone(__name);
-}
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* current_zone() {
- return get_tzdb().current_zone();
-}
-
-_LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
-
-[[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version();
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
- // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_TZDB_LIST_H
diff --git a/libcxx/include/__cxx03/__chrono/weekday.h b/libcxx/include/__cxx03/__chrono/weekday.h
deleted file mode 100644
index fd8081fecc5b9..0000000000000
--- a/libcxx/include/__cxx03/__chrono/weekday.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_WEEKDAY_H
-#define _LIBCPP___CXX03___CHRONO_WEEKDAY_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class weekday_indexed;
-class weekday_last;
-
-class weekday {
-private:
- unsigned char __wd_;
- _LIBCPP_HIDE_FROM_ABI static constexpr unsigned char __weekday_from_days(int __days) noexcept;
-
-public:
- weekday() = default;
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(unsigned __val) noexcept
- : __wd_(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday(const sys_days& __sysd) noexcept
- : __wd_(__weekday_from_days(__sysd.time_since_epoch().count())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr weekday(const local_days& __locd) noexcept
- : __wd_(__weekday_from_days(__locd.time_since_epoch().count())) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator++() noexcept {
- __wd_ = (__wd_ == 6 ? 0 : __wd_ + 1);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator++(int) noexcept {
- weekday __tmp = *this;
- ++(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday& operator--() noexcept {
- __wd_ = (__wd_ == 0 ? 6 : __wd_ - 1);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator--(int) noexcept {
- weekday __tmp = *this;
- --(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
-};
-
-// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr unsigned char weekday::__weekday_from_days(int __days) noexcept {
- return static_cast<unsigned char>(static_cast<unsigned>(__days >= -4 ? (__days + 4) % 7 : (__days + 5) % 7 + 6));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept {
- return __lhs.c_encoding() == __rhs.c_encoding();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept {
- auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
- auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
- return weekday{static_cast<unsigned>(__mu - __yr * 7)};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
- const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
- const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7;
- return days{__wdu - __wk * 7};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept {
- *this = *this + __dd;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept {
- *this = *this - __dd;
- return *this;
-}
-
-class weekday_indexed {
-private:
- chrono::weekday __wd_;
- unsigned char __idx_;
-
-public:
- weekday_indexed() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
- : __wd_{__wdval}, __idx_(__idxval) {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept {
- return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index();
-}
-
-class weekday_last {
-private:
- chrono::weekday __wd_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {}
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept {
- return __lhs.weekday() == __rhs.weekday();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed weekday::operator[](unsigned __index) const noexcept {
- return weekday_indexed{*this, __index};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr weekday_last weekday::operator[](last_spec) const noexcept {
- return weekday_last{*this};
-}
-
-inline constexpr weekday Sunday{0};
-inline constexpr weekday Monday{1};
-inline constexpr weekday Tuesday{2};
-inline constexpr weekday Wednesday{3};
-inline constexpr weekday Thursday{4};
-inline constexpr weekday Friday{5};
-inline constexpr weekday Saturday{6};
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_WEEKDAY_H
diff --git a/libcxx/include/__cxx03/__chrono/year.h b/libcxx/include/__cxx03/__chrono/year.h
deleted file mode 100644
index 3594977e2be99..0000000000000
--- a/libcxx/include/__cxx03/__chrono/year.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_YEAR_H
-#define _LIBCPP___CXX03___CHRONO_YEAR_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class year {
-private:
- short __y_;
-
-public:
- year() = default;
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr year(int __val) noexcept : __y_(static_cast<short>(__val)) {}
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator++() noexcept {
- ++__y_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator++(int) noexcept {
- year __tmp = *this;
- ++(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year& operator--() noexcept {
- --__y_;
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator--(int) noexcept {
- year __tmp = *this;
- --(*this);
- return __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
- return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0);
- }
- _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
- _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept {
- return static_cast<int>(__lhs) == static_cast<int>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, const year& __rhs) noexcept {
- return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
- return year(static_cast<int>(__lhs) + __rhs.count());
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
- return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year& year::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
- static_assert(static_cast<int>(std::numeric_limits<decltype(__y_)>::max()) == static_cast<int>(max()));
- return static_cast<int>(min()) <= __y_;
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CHRONO_YEAR_H
diff --git a/libcxx/include/__cxx03/__chrono/year_month.h b/libcxx/include/__cxx03/__chrono/year_month.h
deleted file mode 100644
index 07652cfc868c1..0000000000000
--- a/libcxx/include/__cxx03/__chrono/year_month.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_YEAR_MONTH_H
-#define _LIBCPP___CXX03___CHRONO_YEAR_MONTH_H
-
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class year_month {
- chrono::year __y_;
- chrono::month __m_;
-
-public:
- year_month() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
- : __y_{__yval}, __m_{__mval} {}
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
- return year_month{__y, __m};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
- return year_month{__y, month(__m)};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept {
- return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
-operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- return __lhs.month() <=> __rhs.month();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept {
- int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
- const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12;
- __dmi = __dmi - __dy * 12 + 1;
- return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept {
- return (__lhs.year() + __rhs) / __lhs.month();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
- return (__lhs.year() - __rhs.year()) +
- months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month()));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_YEAR_MONTH_H
diff --git a/libcxx/include/__cxx03/__chrono/year_month_day.h b/libcxx/include/__cxx03/__chrono/year_month_day.h
deleted file mode 100644
index 551da3e3a1ffd..0000000000000
--- a/libcxx/include/__cxx03/__chrono/year_month_day.h
+++ /dev/null
@@ -1,337 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_YEAR_MONTH_DAY_H
-#define _LIBCPP___CXX03___CHRONO_YEAR_MONTH_DAY_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/monthday.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__chrono/year_month.h>
-#include <__cxx03/__config>
-#include <__cxx03/compare>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class year_month_day_last;
-
-class year_month_day {
-private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::day __d_;
-
-public:
- year_month_day() = default;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(
- const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept
- : __y_{__yval}, __m_{__mval}, __d_{__dval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day(const year_month_day_last& __ymdl) noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day(const sys_days& __sysd) noexcept
- : year_month_day(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_day(const local_days& __locd) noexcept
- : year_month_day(__from_days(__locd.time_since_epoch())) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
- return local_days{__to_days()};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
-};
-
-// https://howardhinnant.github.io/date_algorithms.html#civil_from_days
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day year_month_day::__from_days(days __d) noexcept {
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20, "");
- const int __z = __d.count() + 719468;
- const int __era = (__z >= 0 ? __z : __z - 146096) / 146097;
- const unsigned __doe = static_cast<unsigned>(__z - __era * 146097); // [0, 146096]
- const unsigned __yoe = (__doe - __doe / 1460 + __doe / 36524 - __doe / 146096) / 365; // [0, 399]
- const int __yr = static_cast<int>(__yoe) + __era * 400;
- const unsigned __doy = __doe - (365 * __yoe + __yoe / 4 - __yoe / 100); // [0, 365]
- const unsigned __mp = (5 * __doy + 2) / 153; // [0, 11]
- const unsigned __dy = __doy - (153 * __mp + 2) / 5 + 1; // [1, 31]
- const unsigned __mth = __mp + (__mp < 10 ? 3 : -9); // [1, 12]
- return year_month_day{chrono::year{__yr + (__mth <= 2)}, chrono::month{__mth}, chrono::day{__dy}};
-}
-
-// https://howardhinnant.github.io/date_algorithms.html#days_from_civil
-_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_day::__to_days() const noexcept {
- static_assert(numeric_limits<unsigned>::digits >= 18, "");
- static_assert(numeric_limits<int>::digits >= 20, "");
-
- const int __yr = static_cast<int>(__y_) - (__m_ <= February);
- const unsigned __mth = static_cast<unsigned>(__m_);
- const unsigned __dy = static_cast<unsigned>(__d_);
-
- const int __era = (__yr >= 0 ? __yr : __yr - 399) / 400;
- const unsigned __yoe = static_cast<unsigned>(__yr - __era * 400); // [0, 399]
- const unsigned __doy = (153 * (__mth + (__mth > 2 ? -3 : 9)) + 2) / 5 + __dy - 1; // [0, 365]
- const unsigned __doe = __yoe * 365 + __yoe / 4 - __yoe / 100 + __doy; // [0, 146096]
- return days{__era * 146097 + static_cast<int>(__doe) - 719468};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
- return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
-operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- if (auto __c = __lhs.month() <=> __rhs.month(); __c != 0)
- return __c;
- return __lhs.day() <=> __rhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept {
- return year_month_day{__lhs.year(), __lhs.month(), __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, int __rhs) noexcept {
- return __lhs / day(__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept {
- return __lhs / __rhs.month() / __rhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(int __lhs, const month_day& __rhs) noexcept {
- return year(__lhs) / __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept {
- return __rhs / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, int __rhs) noexcept {
- return year(__rhs) / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator+(const year_month_day& __lhs, const months& __rhs) noexcept {
- return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator+(const months& __lhs, const year_month_day& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator-(const year_month_day& __lhs, const months& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator+(const year_month_day& __lhs, const years& __rhs) noexcept {
- return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator+(const years& __lhs, const year_month_day& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
-operator-(const year_month_day& __lhs, const years& __rhs) noexcept {
- return __lhs + -__rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-class year_month_day_last {
-private:
- chrono::year __y_;
- chrono::month_day_last __mdl_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept
- : __y_{__yval}, __mdl_{__mdlval} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const months& __m) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
- _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept {
- return sys_days{year() / month() / day()};
- }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
- return local_days{year() / month() / day()};
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept {
- constexpr chrono::day __d[] = {
- chrono::day(31),
- chrono::day(28),
- chrono::day(31),
- chrono::day(30),
- chrono::day(31),
- chrono::day(30),
- chrono::day(31),
- chrono::day(31),
- chrono::day(30),
- chrono::day(31),
- chrono::day(30),
- chrono::day(31)};
- return (month() != February || !__y_.is_leap()) && month().ok()
- ? __d[static_cast<unsigned>(month()) - 1]
- : chrono::day{29};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
- return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering
-operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept {
- if (auto __c = __lhs.year() <=> __rhs.year(); __c != 0)
- return __c;
- return __lhs.month_day_last() <=> __rhs.month_day_last();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept {
- return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator/(const year& __lhs, const month_day_last& __rhs) noexcept {
- return year_month_day_last{__lhs, __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept {
- return year_month_day_last{year{__lhs}, __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator/(const month_day_last& __lhs, const year& __rhs) noexcept {
- return __rhs / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept {
- return year{__rhs} / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept {
- return (__lhs.year() / __lhs.month() + __rhs) / last;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept {
- return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
-operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
-year_month_day_last::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
-year_month_day_last::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
-year_month_day_last::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last&
-year_month_day_last::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day::year_month_day(const year_month_day_last& __ymdl) noexcept
- : __y_{__ymdl.year()}, __m_{__ymdl.month()}, __d_{__ymdl.day()} {}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept {
- if (!__y_.ok() || !__m_.ok())
- return false;
- return chrono::day{1} <= __d_ && __d_ <= (__y_ / __m_ / last).day();
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_YEAR_MONTH_DAY_H
diff --git a/libcxx/include/__cxx03/__chrono/year_month_weekday.h b/libcxx/include/__cxx03/__chrono/year_month_weekday.h
deleted file mode 100644
index 3f6974abeb3cc..0000000000000
--- a/libcxx/include/__cxx03/__chrono/year_month_weekday.h
+++ /dev/null
@@ -1,287 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___CHRONO_YEAR_MONTH_WEEKDAY_H
-#define _LIBCPP___CXX03___CHRONO_YEAR_MONTH_WEEKDAY_H
-
-#include <__cxx03/__chrono/calendar.h>
-#include <__cxx03/__chrono/day.h>
-#include <__cxx03/__chrono/duration.h>
-#include <__cxx03/__chrono/month.h>
-#include <__cxx03/__chrono/month_weekday.h>
-#include <__cxx03/__chrono/system_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__chrono/weekday.h>
-#include <__cxx03/__chrono/year.h>
-#include <__cxx03/__chrono/year_month.h>
-#include <__cxx03/__chrono/year_month_day.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace chrono {
-
-class year_month_weekday {
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_indexed __wdi_;
-
-public:
- year_month_weekday() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(
- const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept
- : __y_{__yval}, __m_{__mval}, __wdi_{__wdival} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday(const sys_days& __sysd) noexcept
- : year_month_weekday(__from_days(__sysd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr year_month_weekday(const local_days& __locd) noexcept
- : year_month_weekday(__from_days(__locd.time_since_epoch())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const months&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
- return local_days{__to_days()};
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
- if (!__y_.ok() || !__m_.ok() || !__wdi_.ok())
- return false;
- if (__wdi_.index() <= 4)
- return true;
- auto __nth_weekday_day =
- __wdi_.weekday() - chrono::weekday{static_cast<sys_days>(__y_ / __m_ / 1)} + days{(__wdi_.index() - 1) * 7 + 1};
- return static_cast<unsigned>(__nth_weekday_day.count()) <= static_cast<unsigned>((__y_ / __m_ / last).day());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr year_month_weekday __from_days(days __d) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday year_month_weekday::__from_days(days __d) noexcept {
- const sys_days __sysd{__d};
- const chrono::weekday __wd = chrono::weekday(__sysd);
- const year_month_day __ymd = year_month_day(__sysd);
- return year_month_weekday{__ymd.year(), __ymd.month(), __wd[(static_cast<unsigned>(__ymd.day()) - 1) / 7 + 1]};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday::__to_days() const noexcept {
- const sys_days __sysd = sys_days(__y_ / __m_ / 1);
- return (__sysd + (__wdi_.weekday() - chrono::weekday(__sysd) + days{(__wdi_.index() - 1) * 7})).time_since_epoch();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept {
- return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() &&
- __lhs.weekday_indexed() == __rhs.weekday_indexed();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept {
- return year_month_weekday{__lhs.year(), __lhs.month(), __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator/(const year& __lhs, const month_weekday& __rhs) noexcept {
- return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept {
- return year(__lhs) / __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator/(const month_weekday& __lhs, const year& __rhs) noexcept {
- return __rhs / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept {
- return year(__rhs) / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept {
- return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept {
- return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
-operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-class year_month_weekday_last {
-private:
- chrono::year __y_;
- chrono::month __m_;
- chrono::weekday_last __wdl_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last(
- const chrono::year& __yval, const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept
- : __y_{__yval}, __m_{__mval}, __wdl_{__wdlval} {}
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
- _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
-
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
- _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
- _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
- _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
- return local_days{__to_days()};
- }
- _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr days year_month_weekday_last::__to_days() const noexcept {
- const sys_days __last = sys_days{__y_ / __m_ / last};
- return (__last - (chrono::weekday{__last} - __wdl_.weekday())).time_since_epoch();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool
-operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept {
- return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept {
- return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept {
- return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator/(int __lhs, const month_weekday_last& __rhs) noexcept {
- return year(__lhs) / __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept {
- return __rhs / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator/(const month_weekday_last& __lhs, int __rhs) noexcept {
- return year(__rhs) / __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
- return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last();
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
- return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()};
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept {
- return __rhs + __lhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
-operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
- return __lhs + (-__rhs);
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
-year_month_weekday_last::operator+=(const months& __dm) noexcept {
- *this = *this + __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
-year_month_weekday_last::operator-=(const months& __dm) noexcept {
- *this = *this - __dm;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
-year_month_weekday_last::operator+=(const years& __dy) noexcept {
- *this = *this + __dy;
- return *this;
-}
-_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last&
-year_month_weekday_last::operator-=(const years& __dy) noexcept {
- *this = *this - __dy;
- return *this;
-}
-
-} // namespace chrono
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___CHRONO_YEAR_MONTH_WEEKDAY_H
diff --git a/libcxx/include/__cxx03/__chrono/zoned_time.h b/libcxx/include/__cxx03/__chrono/zoned_time.h
deleted file mode 100644
index 7f83dcfc31a84..0000000000000
--- a/libcxx/include/__cxx03/__chrono/zoned_time.h
+++ /dev/null
@@ -1,227 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
-
-#ifndef _LIBCPP___CXX03___CHRONO_ZONED_TIME_H
-#define _LIBCPP___CXX03___CHRONO_ZONED_TIME_H
-
-#include <__cxx03/version>
-// Enable the contents of the header only when libc++ was built with experimental features enabled.
-#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-# include <__cxx03/__chrono/calendar.h>
-# include <__cxx03/__chrono/duration.h>
-# include <__cxx03/__chrono/sys_info.h>
-# include <__cxx03/__chrono/system_clock.h>
-# include <__cxx03/__chrono/time_zone.h>
-# include <__cxx03/__chrono/tzdb_list.h>
-# include <__cxx03/__config>
-# include <__cxx03/__fwd/string_view.h>
-# include <__cxx03/__type_traits/common_type.h>
-# include <__cxx03/__type_traits/conditional.h>
-# include <__cxx03/__type_traits/remove_cvref.h>
-# include <__cxx03/__utility/move.h>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-namespace chrono {
-
-template <class>
-struct zoned_traits {};
-
-template <>
-struct zoned_traits<const time_zone*> {
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* default_zone() { return chrono::locate_zone("UTC"); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* locate_zone(string_view __name) {
- return chrono::locate_zone(__name);
- }
-};
-
-template <class _Duration, class _TimeZonePtr = const time_zone*>
-class zoned_time {
- // [time.zone.zonedtime.ctor]/2
- static_assert(__is_duration<_Duration>::value,
- "the program is ill-formed since _Duration is not a specialization of std::chrono::duration");
-
- // The wording uses the constraints like
- // constructible_from<zoned_time, decltype(__traits::locate_zone(string_view{}))>
- // Using these constraints in the code causes the compiler to give an
- // error that the constraint depends on itself. To avoid that issue use
- // the fact it is possible to create this object from a _TimeZonePtr.
- using __traits = zoned_traits<_TimeZonePtr>;
-
-public:
- using duration = common_type_t<_Duration, seconds>;
-
- _LIBCPP_HIDE_FROM_ABI zoned_time()
- requires requires { __traits::default_zone(); }
- : __zone_{__traits::default_zone()}, __tp_{} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time&) = default;
- _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const zoned_time&) = default;
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(const sys_time<_Duration>& __tp)
- requires requires { __traits::default_zone(); }
- : __zone_{__traits::default_zone()}, __tp_{__tp} {}
-
- _LIBCPP_HIDE_FROM_ABI explicit zoned_time(_TimeZonePtr __zone) : __zone_{std::move(__zone)}, __tp_{} {}
-
- _LIBCPP_HIDE_FROM_ABI explicit zoned_time(string_view __name)
- requires(requires { __traits::locate_zone(string_view{}); } &&
- constructible_from<_TimeZonePtr, decltype(__traits::locate_zone(string_view{}))>)
- : __zone_{__traits::locate_zone(__name)}, __tp_{} {}
-
- template <class _Duration2>
- _LIBCPP_HIDE_FROM_ABI zoned_time(const zoned_time<_Duration2, _TimeZonePtr>& __zt)
- requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
- : __zone_{__zt.get_time_zone()}, __tp_{__zt.get_sys_time()} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const sys_time<_Duration>& __tp)
- : __zone_{std::move(__zone)}, __tp_{__tp} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const sys_time<_Duration>& __tp)
- requires requires { _TimeZonePtr{__traits::locate_zone(string_view{})}; }
- : zoned_time{__traits::locate_zone(__name), __tp} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp)
- requires(is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})),
- sys_time<duration>>)
- : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp)} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp)
- requires(requires {
- _TimeZonePtr{__traits::locate_zone(string_view{})};
- } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{})),
- sys_time<duration>>)
- : zoned_time{__traits::locate_zone(__name), __tp} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const local_time<_Duration>& __tp, choose __c)
- requires(is_convertible_v<
- decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)),
- sys_time<duration>>)
- : __zone_{std::move(__zone)}, __tp_{__zone_->to_sys(__tp, __c)} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const local_time<_Duration>& __tp, choose __c)
- requires(requires {
- _TimeZonePtr{__traits::locate_zone(string_view{})};
- } && is_convertible_v<decltype(std::declval<_TimeZonePtr&>() -> to_sys(local_time<_Duration>{}, choose::earliest)),
- sys_time<duration>>)
- : zoned_time{__traits::locate_zone(__name), __tp, __c} {}
-
- template <class _Duration2, class _TimeZonePtr2>
- _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt)
- requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
- : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {}
-
- // per wording choose has no effect
- template <class _Duration2, class _TimeZonePtr2>
- _LIBCPP_HIDE_FROM_ABI zoned_time(_TimeZonePtr __zone, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose)
- requires is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>
- : __zone_{std::move(__zone)}, __tp_{__zt.get_sys_time()} {}
-
- template <class _Duration2, class _TimeZonePtr2>
- _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt)
- requires(requires {
- _TimeZonePtr{__traits::locate_zone(string_view{})};
- } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>)
- : zoned_time{__traits::locate_zone(__name), __zt} {}
-
- template <class _Duration2, class _TimeZonePtr2>
- _LIBCPP_HIDE_FROM_ABI zoned_time(string_view __name, const zoned_time<_Duration2, _TimeZonePtr2>& __zt, choose __c)
- requires(requires {
- _TimeZonePtr{__traits::locate_zone(string_view{})};
- } && is_convertible_v<sys_time<_Duration2>, sys_time<_Duration>>)
- : zoned_time{__traits::locate_zone(__name), __zt, __c} {}
-
- _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const sys_time<_Duration>& __tp) {
- __tp_ = __tp;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI zoned_time& operator=(const local_time<_Duration>& __tp) {
- // TODO TZDB This seems wrong.
- // Assigning a non-existent or ambiguous time will throw and not satisfy
- // the post condition. This seems quite odd; I constructed an object with
- // choose::earliest and that choice is not respected.
- // what did LEWG do with this.
- // MSVC STL and libstdc++ behave the same
- __tp_ = __zone_->to_sys(__tp);
- return *this;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI operator sys_time<duration>() const { return get_sys_time(); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit operator local_time<duration>() const { return get_local_time(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _TimeZonePtr get_time_zone() const { return __zone_; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<duration> get_local_time() const { return __zone_->to_local(__tp_); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<duration> get_sys_time() const { return __tp_; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_info get_info() const { return __zone_->get_info(__tp_); }
-
-private:
- _TimeZonePtr __zone_;
- sys_time<duration> __tp_;
-};
-
-zoned_time() -> zoned_time<seconds>;
-
-template <class _Duration>
-zoned_time(sys_time<_Duration>) -> zoned_time<common_type_t<_Duration, seconds>>;
-
-template <class _TimeZonePtrOrName>
-using __time_zone_representation =
- conditional_t<is_convertible_v<_TimeZonePtrOrName, string_view>,
- const time_zone*,
- remove_cvref_t<_TimeZonePtrOrName>>;
-
-template <class _TimeZonePtrOrName>
-zoned_time(_TimeZonePtrOrName&&) -> zoned_time<seconds, __time_zone_representation<_TimeZonePtrOrName>>;
-
-template <class _TimeZonePtrOrName, class _Duration>
-zoned_time(_TimeZonePtrOrName&&, sys_time<_Duration>)
- -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>;
-
-template <class _TimeZonePtrOrName, class _Duration>
-zoned_time(_TimeZonePtrOrName&&, local_time<_Duration>, choose = choose::earliest)
- -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>;
-
-template <class _Duration, class _TimeZonePtrOrName, class TimeZonePtr2>
-zoned_time(_TimeZonePtrOrName&&, zoned_time<_Duration, TimeZonePtr2>, choose = choose::earliest)
- -> zoned_time<common_type_t<_Duration, seconds>, __time_zone_representation<_TimeZonePtrOrName>>;
-
-using zoned_seconds = zoned_time<seconds>;
-
-template <class _Duration1, class _Duration2, class _TimeZonePtr>
-_LIBCPP_HIDE_FROM_ABI bool
-operator==(const zoned_time<_Duration1, _TimeZonePtr>& __lhs, const zoned_time<_Duration2, _TimeZonePtr>& __rhs) {
- return __lhs.get_time_zone() == __rhs.get_time_zone() && __lhs.get_sys_time() == __rhs.get_sys_time();
-}
-
-} // namespace chrono
-
-# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
- // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
-
-#endif // _LIBCPP___CXX03___CHRONO_ZONED_TIME_H
diff --git a/libcxx/include/__cxx03/__compare/common_comparison_category.h b/libcxx/include/__cxx03/__compare/common_comparison_category.h
deleted file mode 100644
index 22375e5fe2dcd..0000000000000
--- a/libcxx/include/__cxx03/__compare/common_comparison_category.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_COMMON_COMPARISON_CATEGORY_H
-#define _LIBCPP___CXX03___COMPARE_COMMON_COMPARISON_CATEGORY_H
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __comp_detail {
-
-enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size };
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory __type_to_enum() noexcept {
- if (is_same_v<_Tp, partial_ordering>)
- return _PartialOrd;
- if (is_same_v<_Tp, weak_ordering>)
- return _WeakOrd;
- if (is_same_v<_Tp, strong_ordering>)
- return _StrongOrd;
- return _None;
-}
-
-template <size_t _Size>
-_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory
-__compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
- int __seen[_CCC_Size] = {};
- for (auto __type : __types)
- ++__seen[__type];
- if (__seen[_None])
- return _None;
- if (__seen[_PartialOrd])
- return _PartialOrd;
- if (__seen[_WeakOrd])
- return _WeakOrd;
- return _StrongOrd;
-}
-
-template <class... _Ts, bool _False = false>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() {
- using _CCC = _ClassifyCompCategory;
- constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
- constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds);
- if constexpr (__cat == _None)
- return void();
- else if constexpr (__cat == _PartialOrd)
- return partial_ordering::equivalent;
- else if constexpr (__cat == _WeakOrd)
- return weak_ordering::equivalent;
- else if constexpr (__cat == _StrongOrd)
- return strong_ordering::equivalent;
- else
- static_assert(_False, "unhandled case");
-}
-} // namespace __comp_detail
-
-// [cmp.common], common comparison category type
-template <class... _Ts>
-struct _LIBCPP_TEMPLATE_VIS common_comparison_category {
- using type = decltype(__comp_detail::__get_comp_type<_Ts...>());
-};
-
-template <class... _Ts>
-using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMMON_COMPARISON_CATEGORY_H
diff --git a/libcxx/include/__cxx03/__compare/compare_partial_order_fallback.h b/libcxx/include/__cxx03/__compare/compare_partial_order_fallback.h
deleted file mode 100644
index faddc2faaa853..0000000000000
--- a/libcxx/include/__cxx03/__compare/compare_partial_order_fallback.h
+++ /dev/null
@@ -1,76 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
-#define _LIBCPP___CXX03___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/partial_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __compare_partial_order_fallback {
-struct __fn {
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
- noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
- return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
- std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
- : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
- ? partial_ordering::greater
- : partial_ordering::unordered))
- -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
- : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
- ? partial_ordering::greater
- : partial_ordering::unordered) {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
- : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
- ? partial_ordering::greater
- : partial_ordering::unordered;
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
- }
-};
-} // namespace __compare_partial_order_fallback
-
-inline namespace __cpo {
-inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
diff --git a/libcxx/include/__cxx03/__compare/compare_strong_order_fallback.h b/libcxx/include/__cxx03/__compare/compare_strong_order_fallback.h
deleted file mode 100644
index 6ba4e49712c07..0000000000000
--- a/libcxx/include/__cxx03/__compare/compare_strong_order_fallback.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
-#define _LIBCPP___CXX03___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/strong_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __compare_strong_order_fallback {
-struct __fn {
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
- noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
- return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
- std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? strong_ordering::less
- : strong_ordering::greater))
- -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? strong_ordering::less
- : strong_ordering::greater) {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? strong_ordering::less
- : strong_ordering::greater;
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
- }
-};
-} // namespace __compare_strong_order_fallback
-
-inline namespace __cpo {
-inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMPARE_STRONG_ORDER_FALLBACK
diff --git a/libcxx/include/__cxx03/__compare/compare_three_way.h b/libcxx/include/__cxx03/__compare/compare_three_way.h
deleted file mode 100644
index 78354b107f213..0000000000000
--- a/libcxx/include/__cxx03/__compare/compare_three_way.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___COMPARE_COMPARE_THREE_WAY_H
-#define _LIBCPP___CXX03___COMPARE_COMPARE_THREE_WAY_H
-
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-struct _LIBCPP_TEMPLATE_VIS compare_three_way {
- template <class _T1, class _T2>
- requires three_way_comparable_with<_T1, _T2>
- constexpr _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u))) {
- return std::forward<_T1>(__t) <=> std::forward<_T2>(__u);
- }
-
- using is_transparent = void;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMPARE_THREE_WAY_H
diff --git a/libcxx/include/__cxx03/__compare/compare_three_way_result.h b/libcxx/include/__cxx03/__compare/compare_three_way_result.h
deleted file mode 100644
index 3b5dccc042e54..0000000000000
--- a/libcxx/include/__cxx03/__compare/compare_three_way_result.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_COMPARE_THREE_WAY_RESULT_H
-#define _LIBCPP___CXX03___COMPARE_COMPARE_THREE_WAY_RESULT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/make_const_lvalue_ref.h>
-#include <__cxx03/__utility/declval.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, class, class>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {};
-
-template <class _Tp, class _Up>
-struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<
- _Tp,
- _Up,
- decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void())> {
- using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
-};
-
-template <class _Tp, class _Up = _Tp>
-struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> {};
-
-template <class _Tp, class _Up = _Tp>
-using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMPARE_THREE_WAY_RESULT_H
diff --git a/libcxx/include/__cxx03/__compare/compare_weak_order_fallback.h b/libcxx/include/__cxx03/__compare/compare_weak_order_fallback.h
deleted file mode 100644
index ecfee76dff272..0000000000000
--- a/libcxx/include/__cxx03/__compare/compare_weak_order_fallback.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
-#define _LIBCPP___CXX03___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/weak_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __compare_weak_order_fallback {
-struct __fn {
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
- noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
- -> decltype(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
- return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
- std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? weak_ordering::less
- : weak_ordering::greater))
- -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? weak_ordering::less
- : weak_ordering::greater) {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent
- : std::forward<_Tp>(__t) < std::forward<_Up>(__u)
- ? weak_ordering::less
- : weak_ordering::greater;
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
- }
-};
-} // namespace __compare_weak_order_fallback
-
-inline namespace __cpo {
-inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_COMPARE_WEAK_ORDER_FALLBACK
diff --git a/libcxx/include/__cxx03/__compare/is_eq.h b/libcxx/include/__cxx03/__compare/is_eq.h
deleted file mode 100644
index 52370834dc408..0000000000000
--- a/libcxx/include/__cxx03/__compare/is_eq.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_IS_EQ_H
-#define _LIBCPP___CXX03___COMPARE_IS_EQ_H
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lt(partial_ordering __c) noexcept { return __c < 0; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lteq(partial_ordering __c) noexcept { return __c <= 0; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; }
-_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; }
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_IS_EQ_H
diff --git a/libcxx/include/__cxx03/__compare/ordering.h b/libcxx/include/__cxx03/__compare/ordering.h
deleted file mode 100644
index 0a497cba682df..0000000000000
--- a/libcxx/include/__cxx03/__compare/ordering.h
+++ /dev/null
@@ -1,278 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_ORDERING_H
-#define _LIBCPP___CXX03___COMPARE_ORDERING_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_same.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// exposition only
-enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 };
-
-enum class _NCmpResult : signed char { __unordered = -127 };
-
-class partial_ordering;
-class weak_ordering;
-class strong_ordering;
-
-template <class _Tp, class... _Args>
-inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...);
-
-struct _CmpUnspecifiedParam {
- _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
-
- template <class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>>
- _CmpUnspecifiedParam(_Tp) = delete;
-};
-
-class partial_ordering {
- using _ValueT = signed char;
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_NCmpResult __v) noexcept : __value_(_ValueT(__v)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __is_ordered() const noexcept {
- return __value_ != _ValueT(_NCmpResult::__unordered);
- }
-
-public:
- // valid values
- static const partial_ordering less;
- static const partial_ordering equivalent;
- static const partial_ordering greater;
- static const partial_ordering unordered;
-
- // comparisons
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ == 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ < 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ <= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ > 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ >= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
- return __v.__is_ordered() && 0 < __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
- return __v.__is_ordered() && 0 <= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
- return __v.__is_ordered() && 0 > __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
- return __v.__is_ordered() && 0 >= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
- operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering
- operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
- return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v);
- }
-
-private:
- _ValueT __value_;
-};
-
-inline constexpr partial_ordering partial_ordering::less(_OrdResult::__less);
-inline constexpr partial_ordering partial_ordering::equivalent(_OrdResult::__equiv);
-inline constexpr partial_ordering partial_ordering::greater(_OrdResult::__greater);
-inline constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__unordered);
-
-class weak_ordering {
- using _ValueT = signed char;
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
-
-public:
- static const weak_ordering less;
- static const weak_ordering equivalent;
- static const weak_ordering greater;
-
- _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
- return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
- }
-
- // comparisons
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ == 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ < 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ <= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ > 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ >= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
- return 0 < __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
- return 0 <= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
- return 0 > __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
- return 0 >= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
- return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v);
- }
-
-private:
- _ValueT __value_;
-};
-
-inline constexpr weak_ordering weak_ordering::less(_OrdResult::__less);
-inline constexpr weak_ordering weak_ordering::equivalent(_OrdResult::__equiv);
-inline constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater);
-
-class strong_ordering {
- using _ValueT = signed char;
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
-
-public:
- static const strong_ordering less;
- static const strong_ordering equal;
- static const strong_ordering equivalent;
- static const strong_ordering greater;
-
- // conversions
- _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept {
- return __value_ == 0 ? partial_ordering::equivalent
- : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr operator weak_ordering() const noexcept {
- return __value_ == 0 ? weak_ordering::equivalent : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
- }
-
- // comparisons
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ == 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ < 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ <= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ > 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__value_ >= 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
- return 0 < __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
- return 0 <= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
- return 0 > __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
- return 0 >= __v.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
- operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
- operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
- return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v);
- }
-
-private:
- _ValueT __value_;
-};
-
-inline constexpr strong_ordering strong_ordering::less(_OrdResult::__less);
-inline constexpr strong_ordering strong_ordering::equal(_OrdResult::__equiv);
-inline constexpr strong_ordering strong_ordering::equivalent(_OrdResult::__equiv);
-inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater);
-
-/// [cmp.categories.pre]/1
-/// The types partial_ordering, weak_ordering, and strong_ordering are
-/// collectively termed the comparison category types.
-template <class _Tp>
-concept __comparison_category = __one_of_v<_Tp, partial_ordering, weak_ordering, strong_ordering>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_ORDERING_H
diff --git a/libcxx/include/__cxx03/__compare/partial_order.h b/libcxx/include/__cxx03/__compare/partial_order.h
deleted file mode 100644
index 119d6581f1242..0000000000000
--- a/libcxx/include/__cxx03/__compare/partial_order.h
+++ /dev/null
@@ -1,77 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER
-#define _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER
-
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/weak_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __partial_order {
-void partial_order() = delete;
-
-struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
- noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
- noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
- noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
- }
-};
-} // namespace __partial_order
-
-inline namespace __cpo {
-inline constexpr auto partial_order = __partial_order::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER
diff --git a/libcxx/include/__cxx03/__compare/strong_order.h b/libcxx/include/__cxx03/__compare/strong_order.h
deleted file mode 100644
index ee29de2b9260f..0000000000000
--- a/libcxx/include/__cxx03/__compare/strong_order.h
+++ /dev/null
@@ -1,143 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_STRONG_ORDER
-#define _LIBCPP___CXX03___COMPARE_STRONG_ORDER
-
-#include <__cxx03/__bit/bit_cast.h>
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__config>
-#include <__cxx03/__math/exponential_functions.h>
-#include <__cxx03/__math/traits.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_floating_point.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/limits>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __strong_order {
-void strong_order() = delete;
-
-struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
- noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept {
- if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int32_t)) {
- int32_t __rx = std::bit_cast<int32_t>(__t);
- int32_t __ry = std::bit_cast<int32_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int32_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int32_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if constexpr (numeric_limits<_Dp>::is_iec559 && sizeof(_Dp) == sizeof(int64_t)) {
- int64_t __rx = std::bit_cast<int64_t>(__t);
- int64_t __ry = std::bit_cast<int64_t>(__u);
- __rx = (__rx < 0) ? (numeric_limits<int64_t>::min() - __rx - 1) : __rx;
- __ry = (__ry < 0) ? (numeric_limits<int64_t>::min() - __ry - 1) : __ry;
- return (__rx <=> __ry);
- } else if (__t < __u) {
- return strong_ordering::less;
- } else if (__t > __u) {
- return strong_ordering::greater;
- } else if (__t == __u) {
- if constexpr (numeric_limits<_Dp>::radix == 2) {
- return __math::signbit(__u) <=> __math::signbit(__t);
- } else {
- // This is bullet 3 of the IEEE754 algorithm, relevant
- // only for decimal floating-point;
- // see https://stackoverflow.com/questions/69068075/
- if (__t == 0 || __math::isinf(__t)) {
- return __math::signbit(__u) <=> __math::signbit(__t);
- } else {
- int __texp, __uexp;
- (void)__math::frexp(__t, &__texp);
- (void)__math::frexp(__u, &__uexp);
- return (__t < 0) ? (__texp <=> __uexp) : (__uexp <=> __texp);
- }
- }
- } else {
- // They're unordered, so one of them must be a NAN.
- // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN.
- bool __t_is_nan = __math::isnan(__t);
- bool __u_is_nan = __math::isnan(__u);
- bool __t_is_negative = __math::signbit(__t);
- bool __u_is_negative = __math::signbit(__u);
- using _IntType =
- conditional_t< sizeof(__t) == sizeof(int32_t),
- int32_t,
- conditional_t< sizeof(__t) == sizeof(int64_t), int64_t, void> >;
- if constexpr (is_same_v<_IntType, void>) {
- static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
- } else if (__t_is_nan && __u_is_nan) {
- // Order by sign bit, then by "payload bits" (we'll just use bit_cast).
- if (__t_is_negative != __u_is_negative) {
- return (__u_is_negative <=> __t_is_negative);
- } else {
- return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u);
- }
- } else if (__t_is_nan) {
- return __t_is_negative ? strong_ordering::less : strong_ordering::greater;
- } else {
- return __u_is_negative ? strong_ordering::greater : strong_ordering::less;
- }
- }
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
- noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
- }
-};
-} // namespace __strong_order
-
-inline namespace __cpo {
-inline constexpr auto strong_order = __strong_order::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___COMPARE_STRONG_ORDER
diff --git a/libcxx/include/__cxx03/__compare/synth_three_way.h b/libcxx/include/__cxx03/__compare/synth_three_way.h
deleted file mode 100644
index 2625ea80bf1b7..0000000000000
--- a/libcxx/include/__cxx03/__compare/synth_three_way.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_SYNTH_THREE_WAY_H
-#define _LIBCPP___CXX03___COMPARE_SYNTH_THREE_WAY_H
-
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/boolean_testable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [expos.only.func]
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
- requires requires {
- { __t < __u } -> __boolean_testable;
- { __u < __t } -> __boolean_testable;
- }
-{
- if constexpr (three_way_comparable_with<_Tp, _Up>) {
- return __t <=> __u;
- } else {
- if (__t < __u)
- return weak_ordering::less;
- if (__u < __t)
- return weak_ordering::greater;
- return weak_ordering::equivalent;
- }
-};
-
-template <class _Tp, class _Up = _Tp>
-using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>()));
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_SYNTH_THREE_WAY_H
diff --git a/libcxx/include/__cxx03/__compare/three_way_comparable.h b/libcxx/include/__cxx03/__compare/three_way_comparable.h
deleted file mode 100644
index a3539459ea25c..0000000000000
--- a/libcxx/include/__cxx03/__compare/three_way_comparable.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_THREE_WAY_COMPARABLE_H
-#define _LIBCPP___CXX03___COMPARE_THREE_WAY_COMPARABLE_H
-
-#include <__cxx03/__compare/common_comparison_category.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/totally_ordered.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/make_const_lvalue_ref.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, class _Cat>
-concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
-
-template <class _Tp, class _Cat = partial_ordering>
-concept three_way_comparable =
- __weakly_equality_comparable_with<_Tp, _Tp> && __partially_ordered_with<_Tp, _Tp> &&
- requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) {
- { __a <=> __b } -> __compares_as<_Cat>;
- };
-
-template <class _Tp, class _Up, class _Cat = partial_ordering>
-concept three_way_comparable_with =
- three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&
- common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
- three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
- __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t <=> __u } -> __compares_as<_Cat>;
- { __u <=> __t } -> __compares_as<_Cat>;
- };
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_THREE_WAY_COMPARABLE_H
diff --git a/libcxx/include/__cxx03/__compare/weak_order.h b/libcxx/include/__cxx03/__compare/weak_order.h
deleted file mode 100644
index 32ab1b68e459a..0000000000000
--- a/libcxx/include/__cxx03/__compare/weak_order.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COMPARE_WEAK_ORDER
-#define _LIBCPP___CXX03___COMPARE_WEAK_ORDER
-
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/strong_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__math/traits.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_floating_point.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/priority_tag.h>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [cmp.alg]
-namespace __weak_order {
-void weak_order() = delete;
-
-struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<3>) noexcept(
- noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _Tp, class _Up, class _Dp = decay_t<_Tp>>
- requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp>
- _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept {
- partial_ordering __po = (__t <=> __u);
- if (__po == partial_ordering::less) {
- return weak_ordering::less;
- } else if (__po == partial_ordering::equivalent) {
- return weak_ordering::equivalent;
- } else if (__po == partial_ordering::greater) {
- return weak_ordering::greater;
- } else {
- // Otherwise, at least one of them is a NaN.
- bool __t_is_nan = __math::isnan(__t);
- bool __u_is_nan = __math::isnan(__u);
- bool __t_is_negative = __math::signbit(__t);
- bool __u_is_negative = __math::signbit(__u);
- if (__t_is_nan && __u_is_nan) {
- return (__u_is_negative <=> __t_is_negative);
- } else if (__t_is_nan) {
- return __t_is_negative ? weak_ordering::less : weak_ordering::greater;
- } else {
- return __u_is_negative ? weak_ordering::greater : weak_ordering::less;
- }
- }
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
- noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
-
- template <class _Tp, class _Up>
- requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
- noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
- -> decltype(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
- }
-
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())))
- -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())) {
- return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>());
- }
-};
-} // namespace __weak_order
-
-inline namespace __cpo {
-inline constexpr auto weak_order = __weak_order::__fn{};
-} // namespace __cpo
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___COMPARE_WEAK_ORDER
diff --git a/libcxx/include/__cxx03/__concepts/arithmetic.h b/libcxx/include/__cxx03/__concepts/arithmetic.h
deleted file mode 100644
index 6c5196bcdf790..0000000000000
--- a/libcxx/include/__cxx03/__concepts/arithmetic.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_ARITHMETIC_H
-#define _LIBCPP___CXX03___CONCEPTS_ARITHMETIC_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_floating_point.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/__type_traits/is_signed.h>
-#include <__cxx03/__type_traits/is_signed_integer.h>
-#include <__cxx03/__type_traits/is_unsigned_integer.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concepts.arithmetic], arithmetic concepts
-
-template <class _Tp>
-concept integral = is_integral_v<_Tp>;
-
-template <class _Tp>
-concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
-
-template <class _Tp>
-concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
-
-template <class _Tp>
-concept floating_point = is_floating_point_v<_Tp>;
-
-// Concept helpers for the internal type traits for the fundamental types.
-
-template <class _Tp>
-concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
-
-template <class _Tp>
-concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
-
-template <class _Tp>
-concept __libcpp_integer = __libcpp_unsigned_integer<_Tp> || __libcpp_signed_integer<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_ARITHMETIC_H
diff --git a/libcxx/include/__cxx03/__concepts/assignable.h b/libcxx/include/__cxx03/__concepts/assignable.h
deleted file mode 100644
index 8b69770222b0a..0000000000000
--- a/libcxx/include/__cxx03/__concepts/assignable.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_ASSIGNABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_ASSIGNABLE_H
-
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/make_const_lvalue_ref.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.assignable]
-
-template <class _Lhs, class _Rhs>
-concept assignable_from =
- is_lvalue_reference_v<_Lhs> &&
- common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
- requires(_Lhs __lhs, _Rhs&& __rhs) {
- { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
- };
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_ASSIGNABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/boolean_testable.h b/libcxx/include/__cxx03/__concepts/boolean_testable.h
deleted file mode 100644
index 21e03f76d8bb1..0000000000000
--- a/libcxx/include/__cxx03/__concepts/boolean_testable.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_BOOLEAN_TESTABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_BOOLEAN_TESTABLE_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concepts.booleantestable]
-
-template <class _Tp>
-concept __boolean_testable_impl = convertible_to<_Tp, bool>;
-
-template <class _Tp>
-concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) {
- { !std::forward<_Tp>(__t) } -> __boolean_testable_impl;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_BOOLEAN_TESTABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/class_or_enum.h b/libcxx/include/__cxx03/__concepts/class_or_enum.h
deleted file mode 100644
index a8604e6d9eb61..0000000000000
--- a/libcxx/include/__cxx03/__concepts/class_or_enum.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_CLASS_OR_ENUM_H
-#define _LIBCPP___CXX03___CONCEPTS_CLASS_OR_ENUM_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_class.h>
-#include <__cxx03/__type_traits/is_enum.h>
-#include <__cxx03/__type_traits/is_union.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// Whether a type is a class type or enumeration type according to the Core wording.
-
-template <class _Tp>
-concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_CLASS_OR_ENUM_H
diff --git a/libcxx/include/__cxx03/__concepts/common_reference_with.h b/libcxx/include/__cxx03/__concepts/common_reference_with.h
deleted file mode 100644
index 1ffe9f67be48b..0000000000000
--- a/libcxx/include/__cxx03/__concepts/common_reference_with.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_COMMON_REFERENCE_WITH_H
-#define _LIBCPP___CXX03___CONCEPTS_COMMON_REFERENCE_WITH_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_reference.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.commonref]
-
-template <class _Tp, class _Up>
-concept common_reference_with =
- same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> &&
- convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_COMMON_REFERENCE_WITH_H
diff --git a/libcxx/include/__cxx03/__concepts/common_with.h b/libcxx/include/__cxx03/__concepts/common_with.h
deleted file mode 100644
index ee100052c0c52..0000000000000
--- a/libcxx/include/__cxx03/__concepts/common_with.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_COMMON_WITH_H
-#define _LIBCPP___CXX03___CONCEPTS_COMMON_WITH_H
-
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/add_lvalue_reference.h>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.common]
-
-// clang-format off
-template <class _Tp, class _Up>
-concept common_with =
- same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> &&
- requires {
- static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>());
- static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>());
- } &&
- common_reference_with<
- add_lvalue_reference_t<const _Tp>,
- add_lvalue_reference_t<const _Up>> &&
- common_reference_with<
- add_lvalue_reference_t<common_type_t<_Tp, _Up>>,
- common_reference_t<
- add_lvalue_reference_t<const _Tp>,
- add_lvalue_reference_t<const _Up>>>;
-// clang-format on
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_COMMON_WITH_H
diff --git a/libcxx/include/__cxx03/__concepts/constructible.h b/libcxx/include/__cxx03/__concepts/constructible.h
deleted file mode 100644
index 2d04667f7d3e4..0000000000000
--- a/libcxx/include/__cxx03/__concepts/constructible.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_CONSTRUCTIBLE_H
-#define _LIBCPP___CXX03___CONCEPTS_CONSTRUCTIBLE_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/destructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_constructible.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.constructible]
-template <class _Tp, class... _Args>
-concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
-
-// [concept.default.init]
-
-template <class _Tp>
-concept __default_initializable = requires { ::new _Tp; };
-
-template <class _Tp>
-concept default_initializable = constructible_from<_Tp> && requires { _Tp{}; } && __default_initializable<_Tp>;
-
-// [concept.moveconstructible]
-template <class _Tp>
-concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;
-
-// [concept.copyconstructible]
-// clang-format off
-template <class _Tp>
-concept copy_constructible =
- move_constructible<_Tp> &&
- constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&
- constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&
- constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
-// clang-format on
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_CONSTRUCTIBLE_H
diff --git a/libcxx/include/__cxx03/__concepts/convertible_to.h b/libcxx/include/__cxx03/__concepts/convertible_to.h
deleted file mode 100644
index af27b76c9c04a..0000000000000
--- a/libcxx/include/__cxx03/__concepts/convertible_to.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_CONVERTIBLE_TO_H
-#define _LIBCPP___CXX03___CONCEPTS_CONVERTIBLE_TO_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.convertible]
-
-template <class _From, class _To>
-concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); };
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_CONVERTIBLE_TO_H
diff --git a/libcxx/include/__cxx03/__concepts/copyable.h b/libcxx/include/__cxx03/__concepts/copyable.h
deleted file mode 100644
index 8ca2d4f940834..0000000000000
--- a/libcxx/include/__cxx03/__concepts/copyable.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_COPYABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_COPYABLE_H
-
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concepts.object]
-
-// clang-format off
-template <class _Tp>
-concept copyable =
- copy_constructible<_Tp> &&
- movable<_Tp> &&
- assignable_from<_Tp&, _Tp&> &&
- assignable_from<_Tp&, const _Tp&> &&
- assignable_from<_Tp&, const _Tp>;
-// clang-format on
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_COPYABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/derived_from.h b/libcxx/include/__cxx03/__concepts/derived_from.h
deleted file mode 100644
index 8112b6c2b70f9..0000000000000
--- a/libcxx/include/__cxx03/__concepts/derived_from.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_DERIVED_FROM_H
-#define _LIBCPP___CXX03___CONCEPTS_DERIVED_FROM_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_base_of.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.derived]
-
-template <class _Dp, class _Bp>
-concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_DERIVED_FROM_H
diff --git a/libcxx/include/__cxx03/__concepts/destructible.h b/libcxx/include/__cxx03/__concepts/destructible.h
deleted file mode 100644
index bd302c3acb62c..0000000000000
--- a/libcxx/include/__cxx03/__concepts/destructible.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_DESTRUCTIBLE_H
-#define _LIBCPP___CXX03___CONCEPTS_DESTRUCTIBLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_nothrow_destructible.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.destructible]
-
-template <class _Tp>
-concept destructible = is_nothrow_destructible_v<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_DESTRUCTIBLE_H
diff --git a/libcxx/include/__cxx03/__concepts/different_from.h b/libcxx/include/__cxx03/__concepts/different_from.h
deleted file mode 100644
index a5d59d47be1d4..0000000000000
--- a/libcxx/include/__cxx03/__concepts/different_from.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_DIFFERENT_FROM_H
-#define _LIBCPP___CXX03___CONCEPTS_DIFFERENT_FROM_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/remove_cvref.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, class _Up>
-concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_DIFFERENT_FROM_H
diff --git a/libcxx/include/__cxx03/__concepts/equality_comparable.h b/libcxx/include/__cxx03/__concepts/equality_comparable.h
deleted file mode 100644
index a3a4504bcb627..0000000000000
--- a/libcxx/include/__cxx03/__concepts/equality_comparable.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_EQUALITY_COMPARABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_EQUALITY_COMPARABLE_H
-
-#include <__cxx03/__concepts/boolean_testable.h>
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/make_const_lvalue_ref.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.equalitycomparable]
-
-template <class _Tp, class _Up>
-concept __weakly_equality_comparable_with =
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t == __u } -> __boolean_testable;
- { __t != __u } -> __boolean_testable;
- { __u == __t } -> __boolean_testable;
- { __u != __t } -> __boolean_testable;
- };
-
-template <class _Tp>
-concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
-
-// clang-format off
-template <class _Tp, class _Up>
-concept equality_comparable_with =
- equality_comparable<_Tp> && equality_comparable<_Up> &&
- common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
- equality_comparable<
- common_reference_t<
- __make_const_lvalue_ref<_Tp>,
- __make_const_lvalue_ref<_Up>>> &&
- __weakly_equality_comparable_with<_Tp, _Up>;
-// clang-format on
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_EQUALITY_COMPARABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/invocable.h b/libcxx/include/__cxx03/__concepts/invocable.h
deleted file mode 100644
index 624d8b0a92465..0000000000000
--- a/libcxx/include/__cxx03/__concepts/invocable.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_INVOCABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_INVOCABLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.invocable]
-
-template <class _Fn, class... _Args>
-concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
- std::invoke(std::forward<_Fn>(__fn), std::forward<_Args>(__args)...); // not required to be equality preserving
-};
-
-// [concept.regular.invocable]
-
-template <class _Fn, class... _Args>
-concept regular_invocable = invocable<_Fn, _Args...>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_INVOCABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/movable.h b/libcxx/include/__cxx03/__concepts/movable.h
deleted file mode 100644
index a0c3372e88c96..0000000000000
--- a/libcxx/include/__cxx03/__concepts/movable.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_MOVABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_MOVABLE_H
-
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/swappable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_object.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concepts.object]
-
-template <class _Tp>
-concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_MOVABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/predicate.h b/libcxx/include/__cxx03/__concepts/predicate.h
deleted file mode 100644
index 5268854d50269..0000000000000
--- a/libcxx/include/__cxx03/__concepts/predicate.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_PREDICATE_H
-#define _LIBCPP___CXX03___CONCEPTS_PREDICATE_H
-
-#include <__cxx03/__concepts/boolean_testable.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.predicate]
-
-template <class _Fn, class... _Args>
-concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_PREDICATE_H
diff --git a/libcxx/include/__cxx03/__concepts/regular.h b/libcxx/include/__cxx03/__concepts/regular.h
deleted file mode 100644
index fd0365ab70435..0000000000000
--- a/libcxx/include/__cxx03/__concepts/regular.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_REGULAR_H
-#define _LIBCPP___CXX03___CONCEPTS_REGULAR_H
-
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.object]
-
-template <class _Tp>
-concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_REGULAR_H
diff --git a/libcxx/include/__cxx03/__concepts/relation.h b/libcxx/include/__cxx03/__concepts/relation.h
deleted file mode 100644
index 67a612979daab..0000000000000
--- a/libcxx/include/__cxx03/__concepts/relation.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_RELATION_H
-#define _LIBCPP___CXX03___CONCEPTS_RELATION_H
-
-#include <__cxx03/__concepts/predicate.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.relation]
-
-template <class _Rp, class _Tp, class _Up>
-concept relation =
- predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> && predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>;
-
-// [concept.equiv]
-
-template <class _Rp, class _Tp, class _Up>
-concept equivalence_relation = relation<_Rp, _Tp, _Up>;
-
-// [concept.strictweakorder]
-
-template <class _Rp, class _Tp, class _Up>
-concept strict_weak_order = relation<_Rp, _Tp, _Up>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_RELATION_H
diff --git a/libcxx/include/__cxx03/__concepts/same_as.h b/libcxx/include/__cxx03/__concepts/same_as.h
deleted file mode 100644
index 5318cda953189..0000000000000
--- a/libcxx/include/__cxx03/__concepts/same_as.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_SAME_AS_H
-#define _LIBCPP___CXX03___CONCEPTS_SAME_AS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_same.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.same]
-
-template <class _Tp, class _Up>
-concept __same_as_impl = _IsSame<_Tp, _Up>::value;
-
-template <class _Tp, class _Up>
-concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_SAME_AS_H
diff --git a/libcxx/include/__cxx03/__concepts/semiregular.h b/libcxx/include/__cxx03/__concepts/semiregular.h
deleted file mode 100644
index 06505080f8d36..0000000000000
--- a/libcxx/include/__cxx03/__concepts/semiregular.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_SEMIREGULAR_H
-#define _LIBCPP___CXX03___CONCEPTS_SEMIREGULAR_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.object]
-
-template <class _Tp>
-concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_SEMIREGULAR_H
diff --git a/libcxx/include/__cxx03/__concepts/swappable.h b/libcxx/include/__cxx03/__concepts/swappable.h
deleted file mode 100644
index 95adb0f1b8dad..0000000000000
--- a/libcxx/include/__cxx03/__concepts/swappable.h
+++ /dev/null
@@ -1,123 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_SWAPPABLE_H
-#define _LIBCPP___CXX03___CONCEPTS_SWAPPABLE_H
-
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/extent.h>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/exchange.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.swappable]
-
-namespace ranges {
-namespace __swap {
-
-template <class _Tp>
-void swap(_Tp&, _Tp&) = delete;
-
-// clang-format off
-template <class _Tp, class _Up>
-concept __unqualified_swappable_with =
- (__class_or_enum<remove_cvref_t<_Tp>> || __class_or_enum<remove_cvref_t<_Up>>) &&
- requires(_Tp&& __t, _Up&& __u) {
- swap(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- };
-// clang-format on
-
-struct __fn;
-
-// clang-format off
-template <class _Tp, class _Up, size_t _Size>
-concept __swappable_arrays =
- !__unqualified_swappable_with<_Tp (&)[_Size], _Up (&)[_Size]> &&
- extent_v<_Tp> == extent_v<_Up> &&
- requires(_Tp (&__t)[_Size], _Up (&__u)[_Size], const __fn& __swap) {
- __swap(__t[0], __u[0]);
- };
-// clang-format on
-
-template <class _Tp>
-concept __exchangeable =
- !__unqualified_swappable_with<_Tp&, _Tp&> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp>;
-
-struct __fn {
- // 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and...
- // *The name `swap` is used here unqualified.
- template <class _Tp, class _Up>
- requires __unqualified_swappable_with<_Tp, _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(swap(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
- swap(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- }
-
- // 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and...
- template <class _Tp, class _Up, size_t _Size>
- requires __swappable_arrays<_Tp, _Up, _Size>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp (&__t)[_Size], _Up (&__u)[_Size]) const
- noexcept(noexcept((*this)(*__t, *__u))) {
- // TODO(cjdb): replace with `ranges::swap_ranges`.
- for (size_t __i = 0; __i < _Size; ++__i) {
- (*this)(__t[__i], __u[__i]);
- }
- }
-
- // 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models...
- template <__exchangeable _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp& __x, _Tp& __y) const
- noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>) {
- __y = std::exchange(__x, std::move(__y));
- }
-};
-} // namespace __swap
-
-inline namespace __cpo {
-inline constexpr auto swap = __swap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-template <class _Tp>
-concept swappable = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); };
-
-template <class _Tp, class _Up>
-concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, _Up&& __u) {
- ranges::swap(std::forward<_Tp>(__t), std::forward<_Tp>(__t));
- ranges::swap(std::forward<_Up>(__u), std::forward<_Up>(__u));
- ranges::swap(std::forward<_Tp>(__t), std::forward<_Up>(__u));
- ranges::swap(std::forward<_Up>(__u), std::forward<_Tp>(__t));
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___CONCEPTS_SWAPPABLE_H
diff --git a/libcxx/include/__cxx03/__concepts/totally_ordered.h b/libcxx/include/__cxx03/__concepts/totally_ordered.h
deleted file mode 100644
index 85ba0e4fdf47d..0000000000000
--- a/libcxx/include/__cxx03/__concepts/totally_ordered.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___CONCEPTS_TOTALLY_ORDERED_H
-#define _LIBCPP___CXX03___CONCEPTS_TOTALLY_ORDERED_H
-
-#include <__cxx03/__concepts/boolean_testable.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/make_const_lvalue_ref.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [concept.totallyordered]
-
-template <class _Tp, class _Up>
-concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t < __u } -> __boolean_testable;
- { __t > __u } -> __boolean_testable;
- { __t <= __u } -> __boolean_testable;
- { __t >= __u } -> __boolean_testable;
- { __u < __t } -> __boolean_testable;
- { __u > __t } -> __boolean_testable;
- { __u <= __t } -> __boolean_testable;
- { __u >= __t } -> __boolean_testable;
-};
-
-template <class _Tp>
-concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>;
-
-// clang-format off
-template <class _Tp, class _Up>
-concept totally_ordered_with =
- totally_ordered<_Tp> && totally_ordered<_Up> &&
- equality_comparable_with<_Tp, _Up> &&
- totally_ordered<
- common_reference_t<
- __make_const_lvalue_ref<_Tp>,
- __make_const_lvalue_ref<_Up>>> &&
- __partially_ordered_with<_Tp, _Up>;
-// clang-format on
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___CONCEPTS_TOTALLY_ORDERED_H
diff --git a/libcxx/include/__cxx03/__coroutine/coroutine_handle.h b/libcxx/include/__cxx03/__coroutine/coroutine_handle.h
deleted file mode 100644
index f96c56bae168b..0000000000000
--- a/libcxx/include/__cxx03/__coroutine/coroutine_handle.h
+++ /dev/null
@@ -1,176 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COROUTINE_COROUTINE_HANDLE_H
-#define _LIBCPP___CXX03___COROUTINE_COROUTINE_HANDLE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/compare>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.handle]
-template <class _Promise = void>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle;
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
-public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI bool done() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI void resume() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI void destroy() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
-
- void* __handle_ = nullptr;
-};
-
-// [coroutine.handle.compare]
-inline _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return __x.address() == __y.address();
-}
-inline _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
-operator<=>(coroutine_handle<> __x, coroutine_handle<> __y) noexcept {
- return compare_three_way()(__x.address(), __y.address());
-}
-
-template <class _Promise>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
-public:
- // [coroutine.handle.con], construct/reset
- constexpr coroutine_handle() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr coroutine_handle(nullptr_t) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI static coroutine_handle from_promise(_Promise& __promise) {
- using _RawPromise = __remove_cv_t<_Promise>;
- coroutine_handle __tmp;
- __tmp.__handle_ =
- __builtin_coro_promise(std::addressof(const_cast<_RawPromise&>(__promise)), alignof(_Promise), true);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI coroutine_handle& operator=(nullptr_t) noexcept {
- __handle_ = nullptr;
- return *this;
- }
-
- // [coroutine.handle.export.import], export/import
- _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr coroutine_handle from_address(void* __addr) noexcept {
- coroutine_handle __tmp;
- __tmp.__handle_ = __addr;
- return __tmp;
- }
-
- // [coroutine.handle.conv], conversion
- _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.observers], observers
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI bool done() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
- return __builtin_coro_done(__handle_);
- }
-
- // [coroutine.handle.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
-
- _LIBCPP_HIDE_FROM_ABI void resume() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done");
- __builtin_coro_resume(__handle_);
- }
-
- _LIBCPP_HIDE_FROM_ABI void destroy() const {
- _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines");
- __builtin_coro_destroy(__handle_);
- }
-
- // [coroutine.handle.promise], promise access
- _LIBCPP_HIDE_FROM_ABI _Promise& promise() const {
- return *static_cast<_Promise*>(__builtin_coro_promise(this->__handle_, alignof(_Promise), false));
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI bool __is_suspended() const {
- // FIXME actually implement a check for if the coro is suspended.
- return __handle_ != nullptr;
- }
- void* __handle_ = nullptr;
-};
-
-// [coroutine.handle.hash]
-template <class _Tp>
-struct hash<coroutine_handle<_Tp>> {
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const coroutine_handle<_Tp>& __v) const noexcept {
- return hash<void*>()(__v.address());
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___COROUTINE_COROUTINE_HANDLE_H
diff --git a/libcxx/include/__cxx03/__coroutine/coroutine_traits.h b/libcxx/include/__cxx03/__coroutine/coroutine_traits.h
deleted file mode 100644
index 2380b7a233910..0000000000000
--- a/libcxx/include/__cxx03/__coroutine/coroutine_traits.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COROUTINE_COROUTINE_TRAITS_H
-#define _LIBCPP___CXX03___COROUTINE_COROUTINE_TRAITS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/void_t.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.traits]
-// [coroutine.traits.primary]
-// The header <coroutine> defined the primary template coroutine_traits such that
-// if ArgTypes is a parameter pack of types and if the qualified-id R::promise_type
-// is valid and denotes a type ([temp.deduct]), then coroutine_traits<R, ArgTypes...>
-// has the following publicly accessible memebr:
-//
-// using promise_type = typename R::promise_type;
-//
-// Otherwise, coroutine_traits<R, ArgTypes...> has no members.
-template <class _Tp, class = void>
-struct __coroutine_traits_sfinae {};
-
-template <class _Tp>
-struct __coroutine_traits_sfinae< _Tp, __void_t<typename _Tp::promise_type> > {
- using promise_type = typename _Tp::promise_type;
-};
-
-template <class _Ret, class... _Args>
-struct coroutine_traits : public __coroutine_traits_sfinae<_Ret> {};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___COROUTINE_COROUTINE_TRAITS_H
diff --git a/libcxx/include/__cxx03/__coroutine/noop_coroutine_handle.h b/libcxx/include/__cxx03/__coroutine/noop_coroutine_handle.h
deleted file mode 100644
index c6ec745dbc2fc..0000000000000
--- a/libcxx/include/__cxx03/__coroutine/noop_coroutine_handle.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___COROUTINE_NOOP_COROUTINE_HANDLE_H
-#define _LIBCPP___CXX03___COROUTINE_NOOP_COROUTINE_HANDLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__coroutine/coroutine_handle.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
-
-// [coroutine.noop]
-// [coroutine.promise.noop]
-struct noop_coroutine_promise {};
-
-// [coroutine.handle.noop]
-template <>
-struct _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> {
-public:
- // [coroutine.handle.noop.conv], conversion
- _LIBCPP_HIDE_FROM_ABI constexpr operator coroutine_handle<>() const noexcept {
- return coroutine_handle<>::from_address(address());
- }
-
- // [coroutine.handle.noop.observers], observers
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool done() const noexcept { return false; }
-
- // [coroutine.handle.noop.resumption], resumption
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr void resume() const noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr void destroy() const noexcept {}
-
- // [coroutine.handle.noop.promise], promise access
- _LIBCPP_HIDE_FROM_ABI noop_coroutine_promise& promise() const noexcept {
- return *static_cast<noop_coroutine_promise*>(
- __builtin_coro_promise(this->__handle_, alignof(noop_coroutine_promise), false));
- }
-
- // [coroutine.handle.noop.address], address
- _LIBCPP_HIDE_FROM_ABI constexpr void* address() const noexcept { return __handle_; }
-
-private:
- _LIBCPP_HIDE_FROM_ABI friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept;
-
-# if __has_builtin(__builtin_coro_noop)
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { this->__handle_ = __builtin_coro_noop(); }
-
- void* __handle_ = nullptr;
-
-# elif defined(_LIBCPP_COMPILER_GCC)
- // GCC doesn't implement __builtin_coro_noop().
- // Construct the coroutine frame manually instead.
- struct __noop_coroutine_frame_ty_ {
- static void __dummy_resume_destroy_func() {}
-
- void (*__resume_)() = __dummy_resume_destroy_func;
- void (*__destroy_)() = __dummy_resume_destroy_func;
- struct noop_coroutine_promise __promise_;
- };
-
- static __noop_coroutine_frame_ty_ __noop_coroutine_frame_;
-
- void* __handle_ = &__noop_coroutine_frame_;
-
- _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default;
-
-# endif // __has_builtin(__builtin_coro_noop)
-};
-
-using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-
-# if defined(_LIBCPP_COMPILER_GCC)
-inline noop_coroutine_handle::__noop_coroutine_frame_ty_ noop_coroutine_handle::__noop_coroutine_frame_{};
-# endif
-
-// [coroutine.noop.coroutine]
-inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); }
-
-# endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___COROUTINE_NOOP_COROUTINE_HANDLE_H
diff --git a/libcxx/include/__cxx03/__coroutine/trivial_awaitables.h b/libcxx/include/__cxx03/__coroutine/trivial_awaitables.h
deleted file mode 100644
index 7e34aad9cfce8..0000000000000
--- a/libcxx/include/__cxx03/__coroutine/trivial_awaitables.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __LIBCPP___CXX03___COROUTINE_TRIVIAL_AWAITABLES_H
-#define __LIBCPP___CXX03___COROUTINE_TRIVIAL_AWAITABLES_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__coroutine/coroutine_handle.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// [coroutine.trivial.awaitables]
-struct suspend_never {
- _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
-};
-
-struct suspend_always {
- _LIBCPP_HIDE_FROM_ABI constexpr bool await_ready() const noexcept { return false; }
- _LIBCPP_HIDE_FROM_ABI constexpr void await_suspend(coroutine_handle<>) const noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr void await_resume() const noexcept {}
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // __LIBCPP_STD_VER >= 20
-
-#endif // __LIBCPP___CXX03___COROUTINE_TRIVIAL_AWAITABLES_H
diff --git a/libcxx/include/__cxx03/__expected/bad_expected_access.h b/libcxx/include/__cxx03/__expected/bad_expected_access.h
deleted file mode 100644
index d9c64976c25b9..0000000000000
--- a/libcxx/include/__cxx03/__expected/bad_expected_access.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___EXPECTED_BAD_EXPECTED_ACCESS_H
-#define _LIBCPP___CXX03___EXPECTED_BAD_EXPECTED_ACCESS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__exception/exception.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Err>
-class bad_expected_access;
-
-_LIBCPP_DIAGNOSTIC_PUSH
-# if !_LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
-# endif
-template <>
-class _LIBCPP_EXPORTED_FROM_ABI bad_expected_access<void> : public exception {
-protected:
- _LIBCPP_HIDE_FROM_ABI bad_expected_access() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI bad_expected_access(const bad_expected_access&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI bad_expected_access(bad_expected_access&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI bad_expected_access& operator=(const bad_expected_access&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI bad_expected_access& operator=(bad_expected_access&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_expected_access() override = default;
-
-public:
-# if _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION
- const char* what() const noexcept override;
-# else
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const noexcept override { return "bad access to std::expected"; }
-# endif
-};
-_LIBCPP_DIAGNOSTIC_POP
-
-template <class _Err>
-class bad_expected_access : public bad_expected_access<void> {
-public:
- _LIBCPP_HIDE_FROM_ABI explicit bad_expected_access(_Err __e) : __unex_(std::move(__e)) {}
-
- _LIBCPP_HIDE_FROM_ABI _Err& error() & noexcept { return __unex_; }
- _LIBCPP_HIDE_FROM_ABI const _Err& error() const& noexcept { return __unex_; }
- _LIBCPP_HIDE_FROM_ABI _Err&& error() && noexcept { return std::move(__unex_); }
- _LIBCPP_HIDE_FROM_ABI const _Err&& error() const&& noexcept { return std::move(__unex_); }
-
-private:
- _Err __unex_;
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___EXPECTED_BAD_EXPECTED_ACCESS_H
diff --git a/libcxx/include/__cxx03/__expected/expected.h b/libcxx/include/__cxx03/__expected/expected.h
deleted file mode 100644
index 1d54bb9f6edeb..0000000000000
--- a/libcxx/include/__cxx03/__expected/expected.h
+++ /dev/null
@@ -1,1874 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___EXPECTED_EXPECTED_H
-#define _LIBCPP___CXX03___EXPECTED_EXPECTED_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__expected/bad_expected_access.h>
-#include <__cxx03/__expected/unexpect.h>
-#include <__cxx03/__expected/unexpected.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/disjunction.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_assignable.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_function.h>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_swappable.h>
-#include <__cxx03/__type_traits/is_trivially_constructible.h>
-#include <__cxx03/__type_traits/is_trivially_destructible.h>
-#include <__cxx03/__type_traits/is_trivially_relocatable.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/lazy.h>
-#include <__cxx03/__type_traits/negation.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/as_const.h>
-#include <__cxx03/__utility/exception_guard.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp, class _Err>
-class expected;
-
-template <class _Tp>
-struct __is_std_expected : false_type {};
-
-template <class _Tp, class _Err>
-struct __is_std_expected<expected<_Tp, _Err>> : true_type {};
-
-struct __expected_construct_in_place_from_invoke_tag {};
-struct __expected_construct_unexpected_from_invoke_tag {};
-
-template <class _Err, class _Arg>
-_LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
-# else
- (void)__arg;
- _LIBCPP_VERBOSE_ABORT("bad_expected_access was thrown in -fno-exceptions mode");
-# endif
-}
-
-// If parameter type `_Tp` of `__conditional_no_unique_address` is neither
-// copyable nor movable, a constructor with this tag is provided. For that
-// constructor, the user has to provide a function and arguments. The function
-// must return an object of type `_Tp`. When the function is invoked by the
-// constructor, guaranteed copy elision kicks in and the `_Tp` is constructed
-// in place.
-struct __conditional_no_unique_address_invoke_tag {};
-
-// This class implements an object with `[[no_unique_address]]` conditionally applied to it,
-// based on the value of `_NoUnique`.
-//
-// A member of this class must always have `[[no_unique_address]]` applied to
-// it. Otherwise, the `[[no_unique_address]]` in the "`_NoUnique == true`" case
-// would not have any effect. In the `false` case, the `__v` is not
-// `[[no_unique_address]]`, so nullifies the effects of the "outer"
-// `[[no_unique_address]]` regarding data layout.
-//
-// If we had a language feature, this class would basically be replaced by `[[no_unique_address(condition)]]`.
-template <bool _NoUnique, class _Tp>
-struct __conditional_no_unique_address;
-
-template <class _Tp>
-struct __conditional_no_unique_address<true, _Tp> {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args)
- : __v(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(
- __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args)
- : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Tp __v;
-};
-
-template <class _Tp>
-struct __conditional_no_unique_address<false, _Tp> {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args)
- : __v(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(
- __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args)
- : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- _Tp __v;
-};
-
-// This function returns whether the type `_Second` can be stuffed into the tail padding
-// of the `_First` type if both of them are given `[[no_unique_address]]`.
-template <class _First, class _Second>
-inline constexpr bool __fits_in_tail_padding = []() {
- struct __x {
- _LIBCPP_NO_UNIQUE_ADDRESS _First __first;
- _LIBCPP_NO_UNIQUE_ADDRESS _Second __second;
- };
- return sizeof(__x) == sizeof(_First);
-}();
-
-// This class implements the storage used by `std::expected`. We have a few
-// goals for this storage:
-// 1. Whenever the underlying {_Tp | _Unex} combination has free bytes in its
-// tail padding, we should reuse it to store the bool discriminator of the
-// expected, so as to save space.
-// 2. Whenever the `expected<_Tp, _Unex>` as a whole has free bytes in its tail
-// padding, we should allow an object following the expected to be stored in
-// its tail padding.
-// 3. However, we never want a user object (say `X`) that would follow an
-// `expected<_Tp, _Unex>` to be stored in the padding bytes of the
-// underlying {_Tp | _Unex} union, if any. That is because we use
-// `construct_at` on that union, which would end up overwriting the `X`
-// member if it is stored in the tail padding of the union.
-//
-// To achieve this, `__expected_base`'s logic is implemented in an inner
-// `__repr` class. `__expected_base` holds one `__repr` member which is
-// conditionally `[[no_unique_address]]`. The `__repr` class holds the
-// underlying {_Tp | _Unex} union and a boolean "has value" flag.
-//
-// Which one of the `__repr_`/`__union_` members is `[[no_unique_address]]`
-// depends on whether the "has value" boolean fits into the tail padding of
-// the underlying {_Tp | _Unex} union:
-//
-// - In case the "has value" bool fits into the tail padding of the union, the
-// whole `__repr_` member is _not_ `[[no_unique_address]]` as it needs to be
-// transparently replaced on `emplace()`/`swap()` etc.
-// - In case the "has value" bool does not fit into the tail padding of the
-// union, only the union member must be transparently replaced (therefore is
-// _not_ `[[no_unique_address]]`) and the "has value" flag must be adjusted
-// manually.
-//
-// This way, the member that is transparently replaced on mutating operations
-// is never `[[no_unique_address]]`, satisfying the requirements from
-// "[basic.life]" in the standard.
-//
-// Stripped away of all superfluous elements, the layout of `__expected_base`
-// then looks like this:
-//
-// template <class Tp, class Err>
-// class expected_base {
-// union union_t {
-// [[no_unique_address]] Tp val;
-// [[no_unique_address]] Err unex;
-// };
-//
-// static constexpr bool put_flag_in_tail = fits_in_tail_padding<union_t, bool>;
-// static constexpr bool allow_reusing_expected_tail_padding = !put_flag_in_tail;
-//
-// struct repr {
-// private:
-// // If "has value" fits into the tail, this should be
-// // `[[no_unique_address]]`, otherwise not.
-// [[no_unique_address]] conditional_no_unique_address<
-// put_flag_in_tail,
-// union_t>::type union_;
-// [[no_unique_address]] bool has_val_;
-// };
-//
-// protected:
-// // If "has value" fits into the tail, this must _not_ be
-// // `[[no_unique_address]]` so that we fill out the
-// // complete `expected` object.
-// [[no_unique_address]] conditional_no_unique_address<
-// allow_reusing_expected_tail_padding,
-// repr>::type repr_;
-// };
-//
-template <class _Tp, class _Err>
-class __expected_base {
- // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
- // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
- // it's not clear that it's implementable, given that the function is allowed to clobber
- // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
- union __union_t {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&)
- requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
- is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
- is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args)
- : __unex_(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)
- = default;
-
- // __repr's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {}
-
- _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_;
- _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_;
- };
-
- static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>;
- static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail;
-
- struct __repr {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag, _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_in_place_from_invoke_tag __tag,
- _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag,
- _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
-
- // The return value of `__make_union` must be constructed in place in the
- // `__v` member of `__union_`, relying on guaranteed copy elision. To do
- // this, the `__conditional_no_unique_address_invoke_tag` constructor is
- // called with a lambda that is immediately called inside
- // `__conditional_no_unique_address`'s constructor.
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other)
- requires(__allow_reusing_expected_tail_padding)
- : __union_(__conditional_no_unique_address_invoke_tag{},
- [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }),
- __has_val_(__has_val) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&)
- requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
- is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
- is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
- requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
- requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)
- {
- __destroy_union_member();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
- requires(__allow_reusing_expected_tail_padding &&
- (is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>))
- {
- // Note: Since the destructor of the union is trivial, this does nothing
- // except to end the lifetime of the union.
- std::destroy_at(&__union_.__v);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
- requires(__allow_reusing_expected_tail_padding &&
- (!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>))
- {
- __destroy_union_member();
- std::destroy_at(&__union_.__v);
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t, _Args&&... __args)
- requires(__allow_reusing_expected_tail_padding)
- {
- std::construct_at(&__union_.__v, in_place, std::forward<_Args>(__args)...);
- __has_val_ = true;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args)
- requires(__allow_reusing_expected_tail_padding)
- {
- std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...);
- __has_val_ = false;
- }
-
- private:
- template <class, class>
- friend class __expected_base;
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member()
- requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)
- {
- if (__has_val_) {
- std::destroy_at(std::addressof(__union_.__v.__val_));
- } else {
- std::destroy_at(std::addressof(__union_.__v.__unex_));
- }
- }
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other)
- requires(__allow_reusing_expected_tail_padding)
- {
- if (__has_val)
- return __union_t(in_place, std::forward<_OtherUnion>(__other).__val_);
- else
- return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_);
- }
-
- _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_;
- _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_;
- };
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other)
- requires(__put_flag_in_tail)
- {
- if (__has_val)
- return __repr(in_place, std::forward<_OtherUnion>(__other).__val_);
- else
- return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_);
- }
-
-protected:
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(_Args&&... __args)
- : __repr_(in_place, std::forward<_Args>(__args)...) {}
-
- // In case we copy/move construct from another `expected` we need to create
- // our `expected` so that it either has a value or not, depending on the "has
- // value" flag of the other `expected`. To do this without falling back on
- // `std::construct_at` we rely on guaranteed copy elision using two helper
- // functions `__make_repr` and `__make_union`. There have to be two since
- // there are two data layouts with different members being
- // `[[no_unique_address]]`. GCC (as of version 13) does not do guaranteed
- // copy elision when initializing `[[no_unique_address]]` members. The two
- // cases are:
- //
- // - `__make_repr`: This is used when the "has value" flag lives in the tail
- // of the union. In this case, the `__repr` member is _not_
- // `[[no_unique_address]]`.
- // - `__make_union`: When the "has value" flag does _not_ fit in the tail of
- // the union, the `__repr` member is `[[no_unique_address]]` and the union
- // is not.
- //
- // This constructor "catches" the first case and leaves the second case to
- // `__union_t`, its constructors and `__make_union`.
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(bool __has_val, _OtherUnion&& __other)
- requires(__put_flag_in_tail)
- : __repr_(__conditional_no_unique_address_invoke_tag{},
- [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() {
- if constexpr (__put_flag_in_tail)
- std::destroy_at(&__repr_.__v);
- else
- __repr_.__v.__destroy_union();
- }
-
- template <class _Tag, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) {
- if constexpr (__put_flag_in_tail)
- std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...);
- else
- __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; }
- _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __val() { return __repr_.__v.__union_.__v.__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& __val() const { return __repr_.__v.__union_.__v.__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_;
-};
-
-template <class _Tp, class _Err>
-class expected : private __expected_base<_Tp, _Err> {
- static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
- !is_same_v<remove_cv_t<_Tp>, unexpect_t> && !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
- __valid_std_unexpected<_Err>::value,
- "[expected.object.general] A program that instantiates the definition of template expected<T, E> for a "
- "reference type, a function type, or for possibly cv-qualified types in_place_t, unexpect_t, or a "
- "specialization of unexpected for the T parameter is ill-formed. A program that instantiates the "
- "definition of the template expected<T, E> with a type for the E parameter that is not a valid "
- "template argument for unexpected is ill-formed.");
-
- template <class _Up, class _OtherErr>
- friend class expected;
-
- using __base = __expected_base<_Tp, _Err>;
-
-public:
- using value_type = _Tp;
- using error_type = _Err;
- using unexpected_type = unexpected<_Err>;
-
- using __trivially_relocatable =
- __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value && __libcpp_is_trivially_relocatable<_Err>::value,
- expected,
- void>;
-
- template <class _Up>
- using rebind = expected<_Up, error_type>;
-
- // [expected.object.ctor], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
- requires is_default_constructible_v<_Tp>
- : __base(in_place) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
- requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Tp> &&
- is_trivially_copy_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __other) noexcept(
- is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
- !(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>))
- : __base(__other.__has_val(), __other.__union()) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Tp> &&
- is_trivially_move_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __other) noexcept(
- is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
- requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
- !(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>))
- : __base(__other.__has_val(), std::move(__other.__union())) {}
-
-private:
- template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual>
- using __can_convert = _And<
- is_constructible<_Tp, _UfQual>,
- is_constructible<_Err, _OtherErrQual>,
- _If<_Not<is_same<remove_cv_t<_Tp>, bool>>::value,
- _And< _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>, // use the copy constructor instead, see #92676
- _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>,
- _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>,
- _Not<is_convertible<expected<_Up, _OtherErr>&, _Tp>>,
- _Not<is_convertible<expected<_Up, _OtherErr>&&, _Tp>>,
- _Not<is_convertible<const expected<_Up, _OtherErr>&, _Tp>>,
- _Not<is_convertible<const expected<_Up, _OtherErr>&&, _Tp>>>,
- true_type>,
- _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>,
- _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>> >;
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
- std::__expected_construct_in_place_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
- std::__expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
-
-public:
- template <class _Up, class _OtherErr>
- requires __can_convert<_Up, _OtherErr, const _Up&, const _OtherErr&>::value
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _Up&, _Tp> ||
- !is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __other) noexcept(
- is_nothrow_constructible_v<_Tp, const _Up&> &&
- is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __base(__other.__has_val(), __other.__union()) {}
-
- template <class _Up, class _OtherErr>
- requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __other) noexcept(
- is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __base(__other.__has_val(), std::move(__other.__union())) {}
-
- template <class _Up = _Tp>
- requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> &&
- is_constructible_v<_Tp, _Up> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
- (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_expected<remove_cvref_t<_Up>>::value))
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>)
- expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
- : __base(in_place, std::forward<_Up>(__u)) {}
-
- template <class _OtherErr>
- requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
- const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __base(unexpect, __unex.error()) {}
-
- template <class _OtherErr>
- requires is_constructible_v<_Err, _OtherErr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __base(unexpect, std::move(__unex.error())) {}
-
- template <class... _Args>
- requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
- : __base(in_place, std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args>
- requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
- : __base(in_place, __il, std::forward<_Args>(__args)...) {}
-
- template <class... _Args>
- requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Err, _Args...>) // strengthened
- : __base(unexpect, std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args>
- requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
- : __base(unexpect, __il, std::forward<_Args>(__args)...) {}
-
- // [expected.object.dtor], destructor
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
-
-private:
- template <class _Tag, class _OtherTag, class _T1, class _T2, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(_T2& __oldval, _Args&&... __args) {
- if constexpr (is_nothrow_constructible_v<_T1, _Args...>) {
- this->__destroy();
- this->__construct(_Tag{}, std::forward<_Args>(__args)...);
- } else if constexpr (is_nothrow_move_constructible_v<_T1>) {
- _T1 __tmp(std::forward<_Args>(__args)...);
- this->__destroy();
- this->__construct(_Tag{}, std::move(__tmp));
- } else {
- static_assert(
- is_nothrow_move_constructible_v<_T2>,
- "To provide strong exception guarantee, T2 has to satisfy `is_nothrow_move_constructible_v` so that it can "
- "be reverted to the previous state in case an exception is thrown during the assignment.");
- _T2 __tmp(std::move(__oldval));
- this->__destroy();
- auto __trans = std::__make_exception_guard([&] { this->__construct(_OtherTag{}, std::move(__tmp)); });
- this->__construct(_Tag{}, std::forward<_Args>(__args)...);
- __trans.__complete();
- }
- }
-
-public:
- // [expected.object.assign], assignment
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
- is_nothrow_copy_assignable_v<_Tp> && is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_assignable_v<_Err> &&
- is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_assignable_v<_Tp> && is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Err> &&
- is_copy_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
- {
- if (this->__has_val() && __rhs.__has_val()) {
- this->__val() = __rhs.__val();
- } else if (this->__has_val()) {
- __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __rhs.__unex());
- } else if (__rhs.__has_val()) {
- __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), __rhs.__val());
- } else {
- this->__unex() = __rhs.__unex();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected&
- operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Tp> && is_nothrow_move_constructible_v<_Tp> &&
- is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
- requires(is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp> && is_move_constructible_v<_Err> &&
- is_move_assignable_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
- {
- if (this->__has_val() && __rhs.__has_val()) {
- this->__val() = std::move(__rhs.__val());
- } else if (this->__has_val()) {
- __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__rhs.__unex()));
- } else if (__rhs.__has_val()) {
- __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::move(__rhs.__val()));
- } else {
- this->__unex() = std::move(__rhs.__unex());
- }
- return *this;
- }
-
- template <class _Up = _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(_Up&& __v)
- requires(!is_same_v<expected, remove_cvref_t<_Up>> && !__is_std_unexpected<remove_cvref_t<_Up>>::value &&
- is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up> &&
- (is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> ||
- is_nothrow_move_constructible_v<_Err>))
- {
- if (this->__has_val()) {
- this->__val() = std::forward<_Up>(__v);
- } else {
- __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::forward<_Up>(__v));
- }
- return *this;
- }
-
-private:
- template <class _OtherErrQual>
- static constexpr bool __can_assign_from_unexpected =
- _And< is_constructible<_Err, _OtherErrQual>,
- is_assignable<_Err&, _OtherErrQual>,
- _Lazy<_Or,
- is_nothrow_constructible<_Err, _OtherErrQual>,
- is_nothrow_move_constructible<_Tp>,
- is_nothrow_move_constructible<_Err>> >::value;
-
-public:
- template <class _OtherErr>
- requires(__can_assign_from_unexpected<const _OtherErr&>)
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
- if (this->__has_val()) {
- __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __un.error());
- } else {
- this->__unex() = __un.error();
- }
- return *this;
- }
-
- template <class _OtherErr>
- requires(__can_assign_from_unexpected<_OtherErr>)
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
- if (this->__has_val()) {
- __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__un.error()));
- } else {
- this->__unex() = std::move(__un.error());
- }
- return *this;
- }
-
- template <class... _Args>
- requires is_nothrow_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(_Args&&... __args) noexcept {
- this->__destroy();
- this->__construct(in_place, std::forward<_Args>(__args)...);
- return this->__val();
- }
-
- template <class _Up, class... _Args>
- requires is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) noexcept {
- this->__destroy();
- this->__construct(in_place, __il, std::forward<_Args>(__args)...);
- return this->__val();
- }
-
-public:
- // [expected.object.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void
- swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp> &&
- is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
- requires(is_swappable_v<_Tp> && is_swappable_v<_Err> && is_move_constructible_v<_Tp> &&
- is_move_constructible_v<_Err> &&
- (is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
- {
- auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
- if constexpr (is_nothrow_move_constructible_v<_Err>) {
- _Err __tmp(std::move(__with_err.__unex()));
- __with_err.__destroy();
- auto __trans = std::__make_exception_guard([&] { __with_err.__construct(unexpect, std::move(__tmp)); });
- __with_err.__construct(in_place, std::move(__with_val.__val()));
- __trans.__complete();
- __with_val.__destroy();
- __with_val.__construct(unexpect, std::move(__tmp));
- } else {
- static_assert(is_nothrow_move_constructible_v<_Tp>,
- "To provide strong exception guarantee, Tp has to satisfy `is_nothrow_move_constructible_v` so "
- "that it can be reverted to the previous state in case an exception is thrown during swap.");
- _Tp __tmp(std::move(__with_val.__val()));
- __with_val.__destroy();
- auto __trans = std::__make_exception_guard([&] { __with_val.__construct(in_place, std::move(__tmp)); });
- __with_val.__construct(unexpect, std::move(__with_err.__unex()));
- __trans.__complete();
- __with_err.__destroy();
- __with_err.__construct(in_place, std::move(__tmp));
- }
- };
-
- if (this->__has_val()) {
- if (__rhs.__has_val()) {
- using std::swap;
- swap(this->__val(), __rhs.__val());
- } else {
- __swap_val_unex_impl(*this, __rhs);
- }
- } else {
- if (__rhs.__has_val()) {
- __swap_val_unex_impl(__rhs, *this);
- } else {
- using std::swap;
- swap(this->__unex(), __rhs.__unex());
- }
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
- requires requires { __x.swap(__y); }
- {
- __x.swap(__y);
- }
-
- // [expected.object.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator-> requires the expected to contain a value");
- return std::addressof(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator-> requires the expected to contain a value");
- return std::addressof(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator* requires the expected to contain a value");
- return this->__val();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator* requires the expected to contain a value");
- return this->__val();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator* requires the expected to contain a value");
- return std::move(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator* requires the expected to contain a value");
- return std::move(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
- static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(std::as_const(error()));
- }
- return this->__val();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & {
- static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(std::as_const(error()));
- }
- return this->__val();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& {
- static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
- "error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(std::move(error()));
- }
- return std::move(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && {
- static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
- "error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(std::move(error()));
- }
- return std::move(this->__val());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return this->__unex();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return this->__unex();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return std::move(this->__unex());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return std::move(this->__unex());
- }
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
- static_assert(is_copy_constructible_v<_Tp>, "value_type has to be copy constructible");
- static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
- return this->__has_val() ? this->__val() : static_cast<_Tp>(std::forward<_Up>(__v));
- }
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
- static_assert(is_move_constructible_v<_Tp>, "value_type has to be move constructible");
- static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
- return this->__has_val() ? std::move(this->__val()) : static_cast<_Tp>(std::forward<_Up>(__v));
- }
-
- template <class _Up = _Err>
- _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
- static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
- if (has_value())
- return std::forward<_Up>(__error);
- return error();
- }
-
- template <class _Up = _Err>
- _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
- static_assert(is_move_constructible_v<_Err>, "error_type has to be move constructible");
- static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
- if (has_value())
- return std::forward<_Up>(__error);
- return std::move(error());
- }
-
- // [expected.void.monadic], monadic
- template <class _Func>
- requires is_constructible_v<_Err, _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
- using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Up::error_type, _Err>,
- "The result of f(**this) must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), this->__val());
- }
- return _Up(unexpect, error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
- using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f(**this) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Up::error_type, _Err>,
- "The result of f(**this) must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), this->__val());
- }
- return _Up(unexpect, error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
- using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&&>>;
- static_assert(
- __is_std_expected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Up::error_type, _Err>,
- "The result of f(std::move(**this)) must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
- }
- return _Up(unexpect, std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
- using _Up = remove_cvref_t<invoke_result_t<_Func, const _Tp&&>>;
- static_assert(
- __is_std_expected<_Up>::value, "The result of f(std::move(**this)) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Up::error_type, _Err>,
- "The result of f(std::move(**this)) must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
- }
- return _Up(unexpect, std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, _Tp&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&>>;
- static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(error()) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp(in_place, this->__val());
- }
- return std::invoke(std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&>>;
- static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(error()) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp(in_place, this->__val());
- }
- return std::invoke(std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, _Tp&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(
- __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(std::move(error())) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp(in_place, std::move(this->__val()));
- }
- return std::invoke(std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, const _Tp&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(
- __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(std::move(error())) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp(in_place, std::move(this->__val()));
- }
- return std::invoke(std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
- using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, error());
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val());
- } else {
- std::invoke(std::forward<_Func>(__f), this->__val());
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
- using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, error());
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val());
- } else {
- std::invoke(std::forward<_Func>(__f), this->__val());
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
- using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, std::move(error()));
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val()));
- } else {
- std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
- using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, std::move(error()));
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val()));
- } else {
- std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, _Tp&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
- using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(error()) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>(in_place, this->__val());
- }
- return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
- using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(error()) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>(in_place, this->__val());
- }
- return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, _Tp&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
- using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(std::move(error())) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
- }
- return expected<_Tp, _Gp>(
- __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Tp, const _Tp&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
- using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(std::move(error())) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
- }
- return expected<_Tp, _Gp>(
- __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
- }
-
- // [expected.object.eq], equality operators
- template <class _T2, class _E2>
- requires(!is_void_v<_T2>)
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
- if (__x.__has_val() != __y.__has_val()) {
- return false;
- } else {
- if (__x.__has_val()) {
- return __x.__val() == __y.__val();
- } else {
- return __x.__unex() == __y.__unex();
- }
- }
- }
-
- template <class _T2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) {
- return __x.__has_val() && static_cast<bool>(__x.__val() == __v);
- }
-
- template <class _E2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __e) {
- return !__x.__has_val() && static_cast<bool>(__x.__unex() == __e.error());
- }
-};
-
-template <class _Err>
-class __expected_void_base {
- struct __empty_t {};
- // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
- // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
- // it's not clear that it's implementable, given that the function is allowed to clobber
- // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
- union __union_t {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&)
- requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&)
- requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t) : __empty_() {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args)
- : __unex_(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_Err>)
- = default;
-
- // __repr's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(!is_trivially_destructible_v<_Err>)
- {}
-
- _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_;
- _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_;
- };
-
- static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>;
- static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail;
-
- struct __repr {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag) : __union_(in_place, __tag), __has_val_(true) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag,
- _Args&&... __args)
- : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other)
- requires(__allow_reusing_expected_tail_padding)
- : __union_(__conditional_no_unique_address_invoke_tag{},
- [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }),
- __has_val_(__has_val) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&)
- requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&)
- requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete;
- _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
- requires(is_trivially_destructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
- requires(!is_trivially_destructible_v<_Err>)
- {
- __destroy_union_member();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
- requires(__allow_reusing_expected_tail_padding && is_trivially_destructible_v<_Err>)
- {
- std::destroy_at(&__union_.__v);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
- requires(__allow_reusing_expected_tail_padding && !is_trivially_destructible_v<_Err>)
- {
- __destroy_union_member();
- std::destroy_at(&__union_.__v);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t)
- requires(__allow_reusing_expected_tail_padding)
- {
- std::construct_at(&__union_.__v, in_place);
- __has_val_ = true;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args)
- requires(__allow_reusing_expected_tail_padding)
- {
- std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...);
- __has_val_ = false;
- }
-
- private:
- template <class>
- friend class __expected_void_base;
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member()
- requires(!is_trivially_destructible_v<_Err>)
- {
- if (!__has_val_)
- std::destroy_at(std::addressof(__union_.__v.__unex_));
- }
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other)
- requires(__allow_reusing_expected_tail_padding)
- {
- if (__has_val)
- return __union_t(in_place);
- else
- return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_);
- }
-
- _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_;
- _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_;
- };
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other)
- requires(__put_flag_in_tail)
- {
- if (__has_val)
- return __repr(in_place);
- else
- return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_);
- }
-
-protected:
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(_Args&&... __args)
- : __repr_(in_place, std::forward<_Args>(__args)...) {}
-
- template <class _OtherUnion>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(bool __has_val, _OtherUnion&& __other)
- requires(__put_flag_in_tail)
- : __repr_(__conditional_no_unique_address_invoke_tag{},
- [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() {
- if constexpr (__put_flag_in_tail)
- std::destroy_at(&__repr_.__v);
- else
- __repr_.__v.__destroy_union();
- }
-
- template <class _Tag, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) {
- if constexpr (__put_flag_in_tail)
- std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...);
- else
- __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; }
- _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_;
-};
-
-template <class _Tp, class _Err>
- requires is_void_v<_Tp>
-class expected<_Tp, _Err> : private __expected_void_base<_Err> {
- static_assert(__valid_std_unexpected<_Err>::value,
- "[expected.void.general] A program that instantiates expected<T, E> with a E that is not a "
- "valid argument for unexpected<E> is ill-formed");
-
- template <class, class>
- friend class expected;
-
- template <class _Up, class _OtherErr, class _OtherErrQual>
- using __can_convert =
- _And< is_void<_Up>,
- is_constructible<_Err, _OtherErrQual>,
- _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<unexpected<_Err>, expected<_Up, _OtherErr>>>,
- _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>,
- _Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>>>;
-
- using __base = __expected_void_base<_Err>;
-
-public:
- using value_type = _Tp;
- using error_type = _Err;
- using unexpected_type = unexpected<_Err>;
-
- template <class _Up>
- using rebind = expected<_Up, error_type>;
-
- // [expected.void.ctor], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __base(in_place) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&)
- requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept(
- is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>)
- : __base(__rhs.__has_val(), __rhs.__union()) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
- requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_v<_Err>)
- requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>)
- : __base(__rhs.__has_val(), std::move(__rhs.__union())) {}
-
- template <class _Up, class _OtherErr>
- requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
- expected(const expected<_Up, _OtherErr>& __rhs) noexcept(
- is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __base(__rhs.__has_val(), __rhs.__union()) {}
-
- template <class _Up, class _OtherErr>
- requires __can_convert<_Up, _OtherErr, _OtherErr>::value
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __base(__rhs.__has_val(), std::move(__rhs.__union())) {}
-
- template <class _OtherErr>
- requires is_constructible_v<_Err, const _OtherErr&>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
- const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __base(unexpect, __unex.error()) {}
-
- template <class _OtherErr>
- requires is_constructible_v<_Err, _OtherErr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
- expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __base(unexpect, std::move(__unex.error())) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __base(in_place) {}
-
- template <class... _Args>
- requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Err, _Args...>) // strengthened
- : __base(unexpect, std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args>
- requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
- : __base(unexpect, __il, std::forward<_Args>(__args)...) {}
-
-private:
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
- __expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
-
-public:
- // [expected.void.dtor], destructor
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
-
-private:
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(unexpect_t, _Args&&... __args) {
- _LIBCPP_ASSERT_INTERNAL(this->__has_val(), "__reinit_expected(unexpect_t, ...) needs value to be set");
-
- this->__destroy();
- auto __trans = std::__make_exception_guard([&] { this->__construct(in_place); });
- this->__construct(unexpect, std::forward<_Args>(__args)...);
- __trans.__complete();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(in_place_t) {
- _LIBCPP_ASSERT_INTERNAL(!this->__has_val(), "__reinit_expected(in_place_t, ...) needs value to be unset");
-
- this->__destroy();
- this->__construct(in_place);
- }
-
-public:
- // [expected.void.assign], assignment
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
- is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
- requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>)
- {
- if (this->__has_val()) {
- if (!__rhs.__has_val()) {
- __reinit_expected(unexpect, __rhs.__unex());
- }
- } else {
- if (__rhs.__has_val()) {
- __reinit_expected(in_place);
- } else {
- this->__unex() = __rhs.__unex();
- }
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(expected&&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr expected&
- operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
- requires(is_move_assignable_v<_Err> && is_move_constructible_v<_Err>)
- {
- if (this->__has_val()) {
- if (!__rhs.__has_val()) {
- __reinit_expected(unexpect, std::move(__rhs.__unex()));
- }
- } else {
- if (__rhs.__has_val()) {
- __reinit_expected(in_place);
- } else {
- this->__unex() = std::move(__rhs.__unex());
- }
- }
- return *this;
- }
-
- template <class _OtherErr>
- requires(is_constructible_v<_Err, const _OtherErr&> && is_assignable_v<_Err&, const _OtherErr&>)
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
- if (this->__has_val()) {
- __reinit_expected(unexpect, __un.error());
- } else {
- this->__unex() = __un.error();
- }
- return *this;
- }
-
- template <class _OtherErr>
- requires(is_constructible_v<_Err, _OtherErr> && is_assignable_v<_Err&, _OtherErr>)
- _LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
- if (this->__has_val()) {
- __reinit_expected(unexpect, std::move(__un.error()));
- } else {
- this->__unex() = std::move(__un.error());
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void emplace() noexcept {
- if (!this->__has_val()) {
- __reinit_expected(in_place);
- }
- }
-
- // [expected.void.swap], swap
- _LIBCPP_HIDE_FROM_ABI constexpr void
- swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
- requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>)
- {
- auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
- // May throw, but will re-engage `__with_val` in that case.
- __with_val.__reinit_expected(unexpect, std::move(__with_err.__unex()));
- // Will not throw.
- __with_err.__reinit_expected(in_place);
- };
-
- if (this->__has_val()) {
- if (!__rhs.__has_val()) {
- __swap_val_unex_impl(*this, __rhs);
- }
- } else {
- if (__rhs.__has_val()) {
- __swap_val_unex_impl(__rhs, *this);
- } else {
- using std::swap;
- swap(this->__unex(), __rhs.__unex());
- }
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(expected& __x, expected& __y) noexcept(noexcept(__x.swap(__y)))
- requires requires { __x.swap(__y); }
- {
- __x.swap(__y);
- }
-
- // [expected.void.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- this->__has_val(), "expected::operator* requires the expected to contain a value");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void value() const& {
- static_assert(is_copy_constructible_v<_Err>);
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(this->__unex());
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void value() && {
- static_assert(is_copy_constructible_v<_Err> && is_move_constructible_v<_Err>);
- if (!this->__has_val()) {
- std::__throw_bad_expected_access<_Err>(std::move(this->__unex()));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return this->__unex();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return this->__unex();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return std::move(this->__unex());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !this->__has_val(), "expected::error requires the expected to contain an error");
- return std::move(this->__unex());
- }
-
- template <class _Up = _Err>
- _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) const& {
- static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
- if (has_value()) {
- return std::forward<_Up>(__error);
- }
- return error();
- }
-
- template <class _Up = _Err>
- _LIBCPP_HIDE_FROM_ABI constexpr _Err error_or(_Up&& __error) && {
- static_assert(is_move_constructible_v<_Err>, "error_type has to be move constructible");
- static_assert(is_convertible_v<_Up, _Err>, "argument has to be convertible to error_type");
- if (has_value()) {
- return std::forward<_Up>(__error);
- }
- return std::move(error());
- }
-
- // [expected.void.monadic], monadic
- template <class _Func>
- requires is_constructible_v<_Err, _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
- using _Up = remove_cvref_t<invoke_result_t<_Func>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
- static_assert(
- is_same_v<typename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f));
- }
- return _Up(unexpect, error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
- using _Up = remove_cvref_t<invoke_result_t<_Func>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
- static_assert(
- is_same_v<typename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f));
- }
- return _Up(unexpect, error());
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
- using _Up = remove_cvref_t<invoke_result_t<_Func>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
- static_assert(
- is_same_v<typename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f));
- }
- return _Up(unexpect, std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
- using _Up = remove_cvref_t<invoke_result_t<_Func>>;
- static_assert(__is_std_expected<_Up>::value, "The result of f() must be a specialization of std::expected");
- static_assert(
- is_same_v<typename _Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
- if (has_value()) {
- return std::invoke(std::forward<_Func>(__f));
- }
- return _Up(unexpect, std::move(error()));
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) & {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&>>;
- static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(error()) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp();
- }
- return std::invoke(std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const& {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&>>;
- static_assert(__is_std_expected<_Gp>::value, "The result of f(error()) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(error()) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp();
- }
- return std::invoke(std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) && {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(
- __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(std::move(error())) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp();
- }
- return std::invoke(std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto or_else(_Func&& __f) const&& {
- using _Gp = remove_cvref_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(
- __is_std_expected<_Gp>::value, "The result of f(std::move(error())) must be a specialization of std::expected");
- static_assert(is_same_v<typename _Gp::value_type, _Tp>,
- "The result of f(std::move(error())) must have the same value_type as this expected");
- if (has_value()) {
- return _Gp();
- }
- return std::invoke(std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
- using _Up = remove_cv_t<invoke_result_t<_Func>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, error());
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f));
- } else {
- std::invoke(std::forward<_Func>(__f));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
- using _Up = remove_cv_t<invoke_result_t<_Func>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, error());
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f));
- } else {
- std::invoke(std::forward<_Func>(__f));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
- using _Up = remove_cv_t<invoke_result_t<_Func>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, std::move(error()));
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f));
- } else {
- std::invoke(std::forward<_Func>(__f));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- requires is_constructible_v<_Err, const _Err&&>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
- using _Up = remove_cv_t<invoke_result_t<_Func>>;
- if (!has_value()) {
- return expected<_Up, _Err>(unexpect, std::move(error()));
- }
- if constexpr (!is_void_v<_Up>) {
- return expected<_Up, _Err>(__expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f));
- } else {
- std::invoke(std::forward<_Func>(__f));
- return expected<_Up, _Err>();
- }
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) & {
- using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(error()) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>();
- }
- return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const& {
- using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(error()) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>();
- }
- return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) && {
- using _Gp = remove_cv_t<invoke_result_t<_Func, _Err&&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(std::move(error())) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>();
- }
- return expected<_Tp, _Gp>(
- __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto transform_error(_Func&& __f) const&& {
- using _Gp = remove_cv_t<invoke_result_t<_Func, const _Err&&>>;
- static_assert(__valid_std_unexpected<_Gp>::value,
- "The result of f(std::move(error())) must be a valid template argument for unexpected");
- if (has_value()) {
- return expected<_Tp, _Gp>();
- }
- return expected<_Tp, _Gp>(
- __expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
- }
-
- // [expected.void.eq], equality operators
- template <class _T2, class _E2>
- requires is_void_v<_T2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
- if (__x.__has_val() != __y.__has_val()) {
- return false;
- } else {
- return __x.__has_val() || static_cast<bool>(__x.__unex() == __y.__unex());
- }
- }
-
- template <class _E2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __y) {
- return !__x.__has_val() && static_cast<bool>(__x.__unex() == __y.error());
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___EXPECTED_EXPECTED_H
diff --git a/libcxx/include/__cxx03/__expected/unexpect.h b/libcxx/include/__cxx03/__expected/unexpect.h
deleted file mode 100644
index d8de027cabc5b..0000000000000
--- a/libcxx/include/__cxx03/__expected/unexpect.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___EXPECTED_UNEXPECT_H
-#define _LIBCPP___CXX03___EXPECTED_UNEXPECT_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-struct unexpect_t {
- explicit unexpect_t() = default;
-};
-
-inline constexpr unexpect_t unexpect{};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-#endif // _LIBCPP___CXX03___EXPECTED_UNEXPECT_H
diff --git a/libcxx/include/__cxx03/__expected/unexpected.h b/libcxx/include/__cxx03/__expected/unexpected.h
deleted file mode 100644
index bafa33a011eea..0000000000000
--- a/libcxx/include/__cxx03/__expected/unexpected.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___EXPECTED_UNEXPECTED_H
-#define _LIBCPP___CXX03___EXPECTED_UNEXPECTED_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_swappable.h>
-#include <__cxx03/__type_traits/is_volatile.h>
-#include <__cxx03/__type_traits/negation.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Err>
-class unexpected;
-
-template <class _Tp>
-struct __is_std_unexpected : false_type {};
-
-template <class _Err>
-struct __is_std_unexpected<unexpected<_Err>> : true_type {};
-
-template <class _Tp>
-using __valid_std_unexpected = _BoolConstant< //
- is_object_v<_Tp> && //
- !is_array_v<_Tp> && //
- !__is_std_unexpected<_Tp>::value && //
- !is_const_v<_Tp> && //
- !is_volatile_v<_Tp> //
- >;
-
-template <class _Err>
-class unexpected {
- static_assert(__valid_std_unexpected<_Err>::value,
- "[expected.un.general] states a program that instantiates std::unexpected for a non-object type, an "
- "array type, a specialization of unexpected, or a cv-qualified type is ill-formed.");
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr unexpected(const unexpected&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr unexpected(unexpected&&) = default;
-
- template <class _Error = _Err>
- requires(!is_same_v<remove_cvref_t<_Error>, unexpected> && //
- !is_same_v<remove_cvref_t<_Error>, in_place_t> && //
- is_constructible_v<_Err, _Error>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(_Error&& __error) //
- noexcept(is_nothrow_constructible_v<_Err, _Error>) // strengthened
- : __unex_(std::forward<_Error>(__error)) {}
-
- template <class... _Args>
- requires is_constructible_v<_Err, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(in_place_t, _Args&&... __args) //
- noexcept(is_nothrow_constructible_v<_Err, _Args...>) // strengthened
- : __unex_(std::forward<_Args>(__args)...) {}
-
- template <class _Up, class... _Args>
- requires is_constructible_v<_Err, initializer_list<_Up>&, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) //
- noexcept(is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
- : __unex_(__il, std::forward<_Args>(__args)...) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(const unexpected&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr unexpected& operator=(unexpected&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { return __unex_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { return __unex_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { return std::move(__unex_); }
- _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { return std::move(__unex_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(unexpected& __other) noexcept(is_nothrow_swappable_v<_Err>) {
- static_assert(is_swappable_v<_Err>, "unexpected::swap requires is_swappable_v<E> to be true");
- using std::swap;
- swap(__unex_, __other.__unex_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(unexpected& __x, unexpected& __y) noexcept(noexcept(__x.swap(__y)))
- requires is_swappable_v<_Err>
- {
- __x.swap(__y);
- }
-
- template <class _Err2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const unexpected& __x, const unexpected<_Err2>& __y) {
- return __x.__unex_ == __y.__unex_;
- }
-
-private:
- _Err __unex_;
-};
-
-template <class _Err>
-unexpected(_Err) -> unexpected<_Err>;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___EXPECTED_UNEXPECTED_H
diff --git a/libcxx/include/__cxx03/__filesystem/copy_options.h b/libcxx/include/__cxx03/__filesystem/copy_options.h
deleted file mode 100644
index 01abb5042b7e4..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/copy_options.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_COPY_OPTIONS_H
-#define _LIBCPP___CXX03___FILESYSTEM_COPY_OPTIONS_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-enum class copy_options : unsigned short {
- none = 0,
- skip_existing = 1,
- overwrite_existing = 2,
- update_existing = 4,
- recursive = 8,
- copy_symlinks = 16,
- skip_symlinks = 32,
- directories_only = 64,
- create_symlinks = 128,
- create_hard_links = 256,
- __in_recursive_copy = 512,
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
- return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
- return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
- return __lhs = __lhs & __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
- return __lhs = __lhs | __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
- return __lhs = __lhs ^ __rhs;
-}
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_COPY_OPTIONS_H
diff --git a/libcxx/include/__cxx03/__filesystem/directory_entry.h b/libcxx/include/__cxx03/__filesystem/directory_entry.h
deleted file mode 100644
index 1a8ebf470bf89..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/directory_entry.h
+++ /dev/null
@@ -1,435 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_DIRECTORY_ENTRY_H
-#define _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_ENTRY_H
-
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/file_status.h>
-#include <__cxx03/__filesystem/file_time_type.h>
-#include <__cxx03/__filesystem/file_type.h>
-#include <__cxx03/__filesystem/filesystem_error.h>
-#include <__cxx03/__filesystem/operations.h>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__filesystem/perms.h>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__system_error/error_code.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-class directory_entry {
- typedef filesystem::path _Path;
-
-public:
- // constructors and destructors
- _LIBCPP_HIDE_FROM_ABI directory_entry() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry const&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_entry(directory_entry&&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI explicit directory_entry(_Path const& __p) : __p_(__p) {
- error_code __ec;
- __refresh(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI ~directory_entry() {}
-
- _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry const&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_entry& operator=(directory_entry&&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p) {
- __p_ = __p;
- error_code __ec;
- __refresh(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI void assign(_Path const& __p, error_code& __ec) {
- __p_ = __p;
- __refresh(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p) {
- __p_.replace_filename(__p);
- error_code __ec;
- __refresh(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI void replace_filename(_Path const& __p, error_code& __ec) {
- __p_ = __p_.parent_path() / __p;
- __refresh(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI void refresh() { __refresh(); }
-
- _LIBCPP_HIDE_FROM_ABI void refresh(error_code& __ec) noexcept { __refresh(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI _Path const& path() const noexcept { return __p_; }
-
- _LIBCPP_HIDE_FROM_ABI operator const _Path&() const noexcept { return __p_; }
-
- _LIBCPP_HIDE_FROM_ABI bool exists() const { return filesystem::exists(file_status{__get_ft()}); }
-
- _LIBCPP_HIDE_FROM_ABI bool exists(error_code& __ec) const noexcept {
- return filesystem::exists(file_status{__get_ft(&__ec)});
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_block_file() const { return __get_ft() == file_type::block; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_block_file(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::block;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_character_file() const { return __get_ft() == file_type::character; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_character_file(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::character;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_directory() const { return __get_ft() == file_type::directory; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_directory(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::directory;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_fifo() const { return __get_ft() == file_type::fifo; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_other() const { return filesystem::is_other(file_status{__get_ft()}); }
-
- _LIBCPP_HIDE_FROM_ABI bool is_other(error_code& __ec) const noexcept {
- return filesystem::is_other(file_status{__get_ft(&__ec)});
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_regular_file() const { return __get_ft() == file_type::regular; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_regular_file(error_code& __ec) const noexcept {
- return __get_ft(&__ec) == file_type::regular;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_socket() const { return __get_ft() == file_type::socket; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_symlink() const { return __get_sym_ft() == file_type::symlink; }
-
- _LIBCPP_HIDE_FROM_ABI bool is_symlink(error_code& __ec) const noexcept {
- return __get_sym_ft(&__ec) == file_type::symlink;
- }
- _LIBCPP_HIDE_FROM_ABI uintmax_t file_size() const { return __get_size(); }
-
- _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count() const { return __get_nlink(); }
-
- _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time() const { return __get_write_time(); }
-
- _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(error_code& __ec) const noexcept {
- return __get_write_time(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI file_status status() const { return __get_status(); }
-
- _LIBCPP_HIDE_FROM_ABI file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI file_status symlink_status() const { return __get_symlink_status(); }
-
- _LIBCPP_HIDE_FROM_ABI file_status symlink_status(error_code& __ec) const noexcept {
- return __get_symlink_status(&__ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; }
-
-# if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; }
-
- _LIBCPP_HIDE_FROM_ABI bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; }
-
- _LIBCPP_HIDE_FROM_ABI bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; }
-
- _LIBCPP_HIDE_FROM_ABI bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; }
-
- _LIBCPP_HIDE_FROM_ABI bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; }
-
-# else // _LIBCPP_STD_VER <= 17
-
- _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const directory_entry& __rhs) const noexcept {
- return __p_ <=> __rhs.__p_;
- }
-
-# endif // _LIBCPP_STD_VER <= 17
-
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const directory_entry& __d) {
- return __os << __d.path();
- }
-
-private:
- friend class directory_iterator;
- friend class recursive_directory_iterator;
- friend class _LIBCPP_HIDDEN __dir_stream;
-
- enum _CacheType : unsigned char {
- _Empty,
- _IterSymlink,
- _IterNonSymlink,
- _RefreshSymlink,
- _RefreshSymlinkUnresolved,
- _RefreshNonSymlink
- };
-
- struct __cached_data {
- uintmax_t __size_;
- uintmax_t __nlink_;
- file_time_type __write_time_;
- perms __sym_perms_;
- perms __non_sym_perms_;
- file_type __type_;
- _CacheType __cache_type_;
-
- _LIBCPP_HIDE_FROM_ABI __cached_data() noexcept { __reset(); }
-
- _LIBCPP_HIDE_FROM_ABI void __reset() {
- __cache_type_ = _Empty;
- __type_ = file_type::none;
- __sym_perms_ = __non_sym_perms_ = perms::unknown;
- __size_ = __nlink_ = uintmax_t(-1);
- __write_time_ = file_time_type::min();
- }
- };
-
- _LIBCPP_HIDE_FROM_ABI static __cached_data __create_iter_result(file_type __ft) {
- __cached_data __data;
- __data.__type_ = __ft;
- __data.__cache_type_ = [&]() {
- switch (__ft) {
- case file_type::none:
- return _Empty;
- case file_type::symlink:
- return _IterSymlink;
- default:
- return _IterNonSymlink;
- }
- }();
- return __data;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
- __p_ = std::move(__p);
- __data_ = __dt;
- }
-
- _LIBCPP_EXPORTED_FROM_ABI error_code __do_refresh() noexcept;
-
- _LIBCPP_HIDE_FROM_ABI static bool __is_dne_error(error_code const& __ec) {
- if (!__ec)
- return true;
- switch (static_cast<errc>(__ec.value())) {
- case errc::no_such_file_or_directory:
- case errc::not_a_directory:
- return true;
- default:
- return false;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI void
- __handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const {
- if (__dest_ec) {
- *__dest_ec = __ec;
- return;
- }
- if (__ec && (!__allow_dne || !__is_dne_error(__ec)))
- __throw_filesystem_error(__msg, __p_, __ec);
- }
-
- _LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
- __handle_error("in directory_entry::refresh",
- __ec,
- __do_refresh(),
- /*allow_dne*/ true);
- }
-
- _LIBCPP_HIDE_FROM_ABI file_type __get_sym_ft(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- return __symlink_status(__p_, __ec).type();
- case _IterSymlink:
- case _RefreshSymlink:
- case _RefreshSymlinkUnresolved:
- if (__ec)
- __ec->clear();
- return file_type::symlink;
- case _IterNonSymlink:
- case _RefreshNonSymlink:
- file_status __st(__data_.__type_);
- if (__ec && !filesystem::exists(__st))
- *__ec = make_error_code(errc::no_such_file_or_directory);
- else if (__ec)
- __ec->clear();
- return __data_.__type_;
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI file_type __get_ft(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterSymlink:
- case _RefreshSymlinkUnresolved:
- return __status(__p_, __ec).type();
- case _IterNonSymlink:
- case _RefreshNonSymlink:
- case _RefreshSymlink: {
- file_status __st(__data_.__type_);
- if (__ec && !filesystem::exists(__st))
- *__ec = make_error_code(errc::no_such_file_or_directory);
- else if (__ec)
- __ec->clear();
- return __data_.__type_;
- }
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI file_status __get_status(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterNonSymlink:
- case _IterSymlink:
- case _RefreshSymlinkUnresolved:
- return __status(__p_, __ec);
- case _RefreshNonSymlink:
- case _RefreshSymlink:
- return file_status(__get_ft(__ec), __data_.__non_sym_perms_);
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI file_status __get_symlink_status(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterNonSymlink:
- case _IterSymlink:
- return __symlink_status(__p_, __ec);
- case _RefreshNonSymlink:
- return file_status(__get_sym_ft(__ec), __data_.__non_sym_perms_);
- case _RefreshSymlink:
- case _RefreshSymlinkUnresolved:
- return file_status(__get_sym_ft(__ec), __data_.__sym_perms_);
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI uintmax_t __get_size(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterNonSymlink:
- case _IterSymlink:
- case _RefreshSymlinkUnresolved:
- return filesystem::__file_size(__p_, __ec);
- case _RefreshSymlink:
- case _RefreshNonSymlink: {
- error_code __m_ec;
- file_status __st(__get_ft(&__m_ec));
- __handle_error("in directory_entry::file_size", __ec, __m_ec);
- if (filesystem::exists(__st) && !filesystem::is_regular_file(__st)) {
- errc __err_kind = filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported;
- __handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind));
- }
- return __data_.__size_;
- }
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI uintmax_t __get_nlink(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterNonSymlink:
- case _IterSymlink:
- case _RefreshSymlinkUnresolved:
- return filesystem::__hard_link_count(__p_, __ec);
- case _RefreshSymlink:
- case _RefreshNonSymlink: {
- error_code __m_ec;
- (void)__get_ft(&__m_ec);
- __handle_error("in directory_entry::hard_link_count", __ec, __m_ec);
- return __data_.__nlink_;
- }
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI file_time_type __get_write_time(error_code* __ec = nullptr) const {
- switch (__data_.__cache_type_) {
- case _Empty:
- case _IterNonSymlink:
- case _IterSymlink:
- case _RefreshSymlinkUnresolved:
- return filesystem::__last_write_time(__p_, __ec);
- case _RefreshSymlink:
- case _RefreshNonSymlink: {
- error_code __m_ec;
- file_status __st(__get_ft(&__m_ec));
- __handle_error("in directory_entry::last_write_time", __ec, __m_ec);
- if (filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min())
- __handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large));
- return __data_.__write_time_;
- }
- }
- __libcpp_unreachable();
- }
-
-private:
- _Path __p_;
- __cached_data __data_;
-};
-
-class __dir_element_proxy {
-public:
- inline _LIBCPP_HIDE_FROM_ABI directory_entry operator*() { return std::move(__elem_); }
-
-private:
- friend class directory_iterator;
- friend class recursive_directory_iterator;
- _LIBCPP_HIDE_FROM_ABI explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {}
- _LIBCPP_HIDE_FROM_ABI __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::move(__o.__elem_)) {}
- directory_entry __elem_;
-};
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_ENTRY_H
diff --git a/libcxx/include/__cxx03/__filesystem/directory_iterator.h b/libcxx/include/__cxx03/__filesystem/directory_iterator.h
deleted file mode 100644
index 226ef7a27f942..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/directory_iterator.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_DIRECTORY_ITERATOR_H
-#define _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_ITERATOR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/directory_entry.h>
-#include <__cxx03/__filesystem/directory_options.h>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/enable_view.h>
-#include <__cxx03/__system_error/error_code.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-class _LIBCPP_HIDDEN __dir_stream;
-class directory_iterator {
-public:
- typedef directory_entry value_type;
- typedef ptrdiff_t difference_type;
- typedef value_type const* pointer;
- typedef value_type const& reference;
- typedef input_iterator_tag iterator_category;
-
-public:
- // ctor & dtor
- _LIBCPP_HIDE_FROM_ABI directory_iterator() noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts)
- : directory_iterator(__p, nullptr, __opts) {}
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {}
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const path& __p, directory_options __opts, error_code& __ec)
- : directory_iterator(__p, &__ec, __opts) {}
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator(const directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_iterator(directory_iterator&&) = default;
- _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(const directory_iterator&) = default;
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator& operator=(directory_iterator&& __o) noexcept {
- // non-default implementation provided to support self-move assign.
- if (this != &__o) {
- __imp_ = std::move(__o.__imp_);
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~directory_iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const {
- // Note: this check duplicates a check in `__dereference()`.
- _LIBCPP_ASSERT_NON_NULL(__imp_, "The end iterator cannot be dereferenced");
- return __dereference();
- }
-
- _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &**this; }
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator& operator++() { return __increment(); }
-
- _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
- __dir_element_proxy __p(**this);
- __increment();
- return __p;
- }
-
- _LIBCPP_HIDE_FROM_ABI directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
-
-# if _LIBCPP_STD_VER >= 20
-
- _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const noexcept { return *this == directory_iterator(); }
-
-# endif
-
-private:
- inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept;
-
- // construct the dir_stream
- _LIBCPP_EXPORTED_FROM_ABI directory_iterator(const path&, error_code*, directory_options = directory_options::none);
-
- _LIBCPP_EXPORTED_FROM_ABI directory_iterator& __increment(error_code* __ec = nullptr);
-
- _LIBCPP_EXPORTED_FROM_ABI const directory_entry& __dereference() const;
-
-private:
- shared_ptr<__dir_stream> __imp_;
-};
-
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
- return __lhs.__imp_ == __rhs.__imp_;
-}
-
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept {
- return !(__lhs == __rhs);
-}
-
-// enable directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator begin(directory_iterator __iter) noexcept { return __iter; }
-
-inline _LIBCPP_HIDE_FROM_ABI directory_iterator end(directory_iterator) noexcept { return directory_iterator(); }
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-# if _LIBCPP_STD_VER >= 20
-
-template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
- std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
-
-template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
- std::ranges::enable_view<std::filesystem::directory_iterator> = true;
-
-# endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_ITERATOR_H
diff --git a/libcxx/include/__cxx03/__filesystem/directory_options.h b/libcxx/include/__cxx03/__filesystem/directory_options.h
deleted file mode 100644
index babdf9c911bee..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/directory_options.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_DIRECTORY_OPTIONS_H
-#define _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_OPTIONS_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 };
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator&(directory_options __lhs, directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator|(directory_options __lhs, directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator^(directory_options __lhs, directory_options __rhs) {
- return static_cast<directory_options>(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr directory_options operator~(directory_options __lhs) {
- return static_cast<directory_options>(~static_cast<unsigned char>(__lhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline directory_options& operator&=(directory_options& __lhs, directory_options __rhs) {
- return __lhs = __lhs & __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline directory_options& operator|=(directory_options& __lhs, directory_options __rhs) {
- return __lhs = __lhs | __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline directory_options& operator^=(directory_options& __lhs, directory_options __rhs) {
- return __lhs = __lhs ^ __rhs;
-}
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_DIRECTORY_OPTIONS_H
diff --git a/libcxx/include/__cxx03/__filesystem/file_status.h b/libcxx/include/__cxx03/__filesystem/file_status.h
deleted file mode 100644
index 1e5ea497434d9..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/file_status.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_FILE_STATUS_H
-#define _LIBCPP___CXX03___FILESYSTEM_FILE_STATUS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/file_type.h>
-#include <__cxx03/__filesystem/perms.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-class _LIBCPP_EXPORTED_FROM_ABI file_status {
-public:
- // constructors
- _LIBCPP_HIDE_FROM_ABI file_status() noexcept : file_status(file_type::none) {}
- _LIBCPP_HIDE_FROM_ABI explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept
- : __ft_(__ft), __prms_(__prms) {}
-
- _LIBCPP_HIDE_FROM_ABI file_status(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status(file_status&&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI ~file_status() {}
-
- _LIBCPP_HIDE_FROM_ABI file_status& operator=(const file_status&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI file_status& operator=(file_status&&) noexcept = default;
-
- // observers
- _LIBCPP_HIDE_FROM_ABI file_type type() const noexcept { return __ft_; }
-
- _LIBCPP_HIDE_FROM_ABI perms permissions() const noexcept { return __prms_; }
-
- // modifiers
- _LIBCPP_HIDE_FROM_ABI void type(file_type __ft) noexcept { __ft_ = __ft; }
-
- _LIBCPP_HIDE_FROM_ABI void permissions(perms __p) noexcept { __prms_ = __p; }
-
-# if _LIBCPP_STD_VER >= 20
-
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const file_status& __lhs, const file_status& __rhs) noexcept {
- return __lhs.type() == __rhs.type() && __lhs.permissions() == __rhs.permissions();
- }
-
-# endif
-
-private:
- file_type __ft_;
- perms __prms_;
-};
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_FILE_STATUS_H
diff --git a/libcxx/include/__cxx03/__filesystem/file_time_type.h b/libcxx/include/__cxx03/__filesystem/file_time_type.h
deleted file mode 100644
index cd52453b0b879..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/file_time_type.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_FILE_TIME_TYPE_H
-#define _LIBCPP___CXX03___FILESYSTEM_FILE_TIME_TYPE_H
-
-#include <__cxx03/__chrono/file_clock.h>
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-typedef chrono::time_point<_FilesystemClock> file_time_type;
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_FILE_TIME_TYPE_H
diff --git a/libcxx/include/__cxx03/__filesystem/file_type.h b/libcxx/include/__cxx03/__filesystem/file_type.h
deleted file mode 100644
index 34f0aba307128..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/file_type.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_FILE_TYPE_H
-#define _LIBCPP___CXX03___FILESYSTEM_FILE_TYPE_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-// On Windows, the library never identifies files as block, character, fifo
-// or socket.
-enum class file_type : signed char {
- none = 0,
- not_found = -1,
- regular = 1,
- directory = 2,
- symlink = 3,
- block = 4,
- character = 5,
- fifo = 6,
- socket = 7,
- unknown = 8
-};
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_FILE_TYPE_H
diff --git a/libcxx/include/__cxx03/__filesystem/filesystem_error.h b/libcxx/include/__cxx03/__filesystem/filesystem_error.h
deleted file mode 100644
index ef9e0d7846436..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/filesystem_error.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_FILESYSTEM_ERROR_H
-#define _LIBCPP___CXX03___FILESYSTEM_FILESYSTEM_ERROR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__system_error/error_code.h>
-#include <__cxx03/__system_error/system_error.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/string>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
-public:
- _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, error_code __ec)
- : system_error(__ec, __what), __storage_(make_shared<_Storage>(path(), path())) {
- __create_what(0);
- }
-
- _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, error_code __ec)
- : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, path())) {
- __create_what(1);
- }
-
- _LIBCPP_HIDE_FROM_ABI filesystem_error(const string& __what, const path& __p1, const path& __p2, error_code __ec)
- : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, __p2)) {
- __create_what(2);
- }
-
- _LIBCPP_HIDE_FROM_ABI const path& path1() const noexcept { return __storage_->__p1_; }
-
- _LIBCPP_HIDE_FROM_ABI const path& path2() const noexcept { return __storage_->__p2_; }
-
- _LIBCPP_HIDE_FROM_ABI filesystem_error(const filesystem_error&) = default;
- ~filesystem_error() override; // key function
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- const char* what() const noexcept override { return __storage_->__what_.c_str(); }
-
- void __create_what(int __num_paths);
-
-private:
- struct _LIBCPP_HIDDEN _Storage {
- _LIBCPP_HIDE_FROM_ABI _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {}
-
- path __p1_;
- path __p2_;
- string __what_;
- };
- shared_ptr<_Storage> __storage_;
-};
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
-template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
-__throw_filesystem_error(_Args&&... __args) {
- throw filesystem_error(std::forward<_Args>(__args)...);
-}
-# else
-template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
-__throw_filesystem_error(_Args&&...) {
- _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
-}
-# endif
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_FILESYSTEM_ERROR_H
diff --git a/libcxx/include/__cxx03/__filesystem/operations.h b/libcxx/include/__cxx03/__filesystem/operations.h
deleted file mode 100644
index fdb3dab858f50..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/operations.h
+++ /dev/null
@@ -1,310 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_OPERATIONS_H
-#define _LIBCPP___CXX03___FILESYSTEM_OPERATIONS_H
-
-#include <__cxx03/__chrono/time_point.h>
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/copy_options.h>
-#include <__cxx03/__filesystem/file_status.h>
-#include <__cxx03/__filesystem/file_time_type.h>
-#include <__cxx03/__filesystem/file_type.h>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__filesystem/perm_options.h>
-#include <__cxx03/__filesystem/perms.h>
-#include <__cxx03/__filesystem/space_info.h>
-#include <__cxx03/__system_error/error_code.h>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool
-__copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void
-__copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void
-__copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __create_directories(const path&, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void
-__create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __create_directory(const path&, const path& __attributes, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void
-__create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void
-__create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI path __current_path(error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __current_path(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __equivalent(const path&, const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI file_status __status(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI uintmax_t __file_size(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI file_status __symlink_status(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI file_time_type __last_write_time(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __last_write_time(const path&, file_time_type __new_time, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI path __weakly_canonical(path const& __p, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI path __read_symlink(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI uintmax_t __remove_all(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI bool __remove(const path&, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __rename(const path& __from, const path& __to, error_code* __ec = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI void __resize_file(const path&, uintmax_t __size, error_code* = nullptr);
-_LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr);
-
-inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p) { return __canonical(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to) {
- return __copy_file(__from, __to, copy_options::none);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, error_code& __ec) {
- return __copy_file(__from, __to, copy_options::none, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool copy_file(const path& __from, const path& __to, copy_options __opt) {
- return __copy_file(__from, __to, __opt);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool
-copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
- return __copy_file(__from, __to, __opt, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to) { __copy_symlink(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void copy_symlink(const path& __from, const path& __to, error_code& __ec) noexcept {
- __copy_symlink(__from, __to, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to) {
- __copy(__from, __to, copy_options::none);
-}
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, error_code& __ec) {
- __copy(__from, __to, copy_options::none, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt) {
- __copy(__from, __to, __opt);
-}
-inline _LIBCPP_HIDE_FROM_ABI void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) {
- __copy(__from, __to, __opt, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p) { return __create_directories(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directories(const path& __p, error_code& __ec) {
- return __create_directories(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void create_directory_symlink(const path& __target, const path& __link) {
- __create_directory_symlink(__target, __link);
-}
-inline _LIBCPP_HIDE_FROM_ABI void
-create_directory_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
- __create_directory_symlink(__target, __link, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p) { return __create_directory(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, error_code& __ec) noexcept {
- return __create_directory(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs) {
- return __create_directory(__p, __attrs);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept {
- return __create_directory(__p, __attrs, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void create_hard_link(const path& __target, const path& __link) {
- __create_hard_link(__target, __link);
-}
-inline _LIBCPP_HIDE_FROM_ABI void
-create_hard_link(const path& __target, const path& __link, error_code& __ec) noexcept {
- __create_hard_link(__target, __link, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link) {
- __create_symlink(__target, __link);
-}
-inline _LIBCPP_HIDE_FROM_ABI void create_symlink(const path& __target, const path& __link, error_code& __ec) noexcept {
- return __create_symlink(__target, __link, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI path current_path() { return __current_path(); }
-inline _LIBCPP_HIDE_FROM_ABI path current_path(error_code& __ec) { return __current_path(&__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p) { __current_path(__p); }
-inline _LIBCPP_HIDE_FROM_ABI void current_path(const path& __p, error_code& __ec) noexcept {
- __current_path(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); }
-inline _LIBCPP_HIDE_FROM_ABI bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept {
- return __equivalent(__p1, __p2, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; }
-inline _LIBCPP_HIDE_FROM_ABI bool exists(file_status __s) noexcept {
- return status_known(__s) && __s.type() != file_type::not_found;
-}
-inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p) { return exists(__status(__p)); }
-
-inline _LIBCPP_HIDE_FROM_ABI bool exists(const path& __p, error_code& __ec) noexcept {
- auto __s = __status(__p, &__ec);
- if (status_known(__s))
- __ec.clear();
- return exists(__s);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p) { return __file_size(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t file_size(const path& __p, error_code& __ec) noexcept {
- return __file_size(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept {
- return __hard_link_count(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p) { return is_block_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_block_file(const path& __p, error_code& __ec) noexcept {
- return is_block_file(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(file_status __s) noexcept {
- return __s.type() == file_type::character;
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p) { return is_character_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_character_file(const path& __p, error_code& __ec) noexcept {
- return is_character_file(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p) { return is_directory(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_directory(const path& __p, error_code& __ec) noexcept {
- return is_directory(__status(__p, &__ec));
-}
-_LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
-inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p) { return __fs_is_empty(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p) { return is_fifo(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_fifo(const path& __p, error_code& __ec) noexcept {
- return is_fifo(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_regular_file(const path& __p, error_code& __ec) noexcept {
- return is_regular_file(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_symlink(const path& __p, error_code& __ec) noexcept {
- return is_symlink(__symlink_status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(file_status __s) noexcept {
- return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p) { return is_other(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_other(const path& __p, error_code& __ec) noexcept {
- return is_other(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; }
-inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p) { return is_socket(__status(__p)); }
-inline _LIBCPP_HIDE_FROM_ABI bool is_socket(const path& __p, error_code& __ec) noexcept {
- return is_socket(__status(__p, &__ec));
-}
-inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p) { return __last_write_time(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_time_type last_write_time(const path& __p, error_code& __ec) noexcept {
- return __last_write_time(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); }
-inline _LIBCPP_HIDE_FROM_ABI void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept {
- __last_write_time(__p, __t, &__ec);
-}
-_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
-inline _LIBCPP_HIDE_FROM_ABI void
-permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) {
- __permissions(__p, __prms, __opts);
-}
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, error_code& __ec) noexcept {
- __permissions(__p, __prms, perm_options::replace, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) {
- __permissions(__p, __prms, __opts, &__ec);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base, error_code& __ec) {
- path __tmp = __weakly_canonical(__p, &__ec);
- if (__ec)
- return {};
- path __tmp_base = __weakly_canonical(__base, &__ec);
- if (__ec)
- return {};
- return __tmp.lexically_proximate(__tmp_base);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, error_code& __ec) {
- return proximate(__p, current_path(), __ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI path proximate(const path& __p, const path& __base = current_path()) {
- return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base));
-}
-inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p) { return __read_symlink(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); }
-
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base, error_code& __ec) {
- path __tmp = __weakly_canonical(__p, &__ec);
- if (__ec)
- return path();
- path __tmpbase = __weakly_canonical(__base, &__ec);
- if (__ec)
- return path();
- return __tmp.lexically_relative(__tmpbase);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, error_code& __ec) {
- return relative(__p, current_path(), __ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI path relative(const path& __p, const path& __base = current_path()) {
- return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base));
-}
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p) { return __remove_all(__p); }
-inline _LIBCPP_HIDE_FROM_ABI uintmax_t remove_all(const path& __p, error_code& __ec) {
- return __remove_all(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p) { return __remove(__p); }
-inline _LIBCPP_HIDE_FROM_ABI bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); }
-inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to) { return __rename(__from, __to); }
-inline _LIBCPP_HIDE_FROM_ABI void rename(const path& __from, const path& __to, error_code& __ec) noexcept {
- return __rename(__from, __to, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); }
-inline _LIBCPP_HIDE_FROM_ABI void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept {
- return __resize_file(__p, __ns, &__ec);
-}
-_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
-inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p) { return __space(__p); }
-inline _LIBCPP_HIDE_FROM_ABI space_info space(const path& __p, error_code& __ec) noexcept {
- return __space(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p) { return __status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status status(const path& __p, error_code& __ec) noexcept {
- return __status(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p) { return __symlink_status(__p); }
-inline _LIBCPP_HIDE_FROM_ABI file_status symlink_status(const path& __p, error_code& __ec) noexcept {
- return __symlink_status(__p, &__ec);
-}
-inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path() { return __temp_directory_path(); }
-inline _LIBCPP_HIDE_FROM_ABI path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); }
-inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p) { return __weakly_canonical(__p); }
-inline _LIBCPP_HIDE_FROM_ABI path weakly_canonical(path const& __p, error_code& __ec) {
- return __weakly_canonical(__p, &__ec);
-}
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_OPERATIONS_H
diff --git a/libcxx/include/__cxx03/__filesystem/path.h b/libcxx/include/__cxx03/__filesystem/path.h
deleted file mode 100644
index e5eed68e4d6c4..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/path.h
+++ /dev/null
@@ -1,931 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_PATH_H
-#define _LIBCPP___CXX03___FILESYSTEM_PATH_H
-
-#include <__cxx03/__algorithm/replace.h>
-#include <__cxx03/__algorithm/replace_copy.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/unary_function.h>
-#include <__cxx03/__fwd/functional.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <__cxx03/iomanip> // for quoted
-# include <__cxx03/locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-template <class _Tp>
-struct __can_convert_char {
- static const bool value = false;
-};
-template <class _Tp>
-struct __can_convert_char<const _Tp> : public __can_convert_char<_Tp> {};
-template <>
-struct __can_convert_char<char> {
- static const bool value = true;
- using __char_type = char;
-};
-template <>
-struct __can_convert_char<wchar_t> {
- static const bool value = true;
- using __char_type = wchar_t;
-};
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
-template <>
-struct __can_convert_char<char8_t> {
- static const bool value = true;
- using __char_type = char8_t;
-};
-# endif
-template <>
-struct __can_convert_char<char16_t> {
- static const bool value = true;
- using __char_type = char16_t;
-};
-template <>
-struct __can_convert_char<char32_t> {
- static const bool value = true;
- using __char_type = char32_t;
-};
-
-template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI bool __is_separator(_ECharT __e) {
-# if defined(_LIBCPP_WIN32API)
- return __e == _ECharT('/') || __e == _ECharT('\\');
-# else
- return __e == _ECharT('/');
-# endif
-}
-
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
-typedef u8string __u8_string;
-# else
-typedef string __u8_string;
-# endif
-
-struct _NullSentinel {};
-
-template <class _Tp>
-using _Void = void;
-
-template <class _Tp, class = void>
-struct __is_pathable_string : public false_type {};
-
-template <class _ECharT, class _Traits, class _Alloc>
-struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
- : public __can_convert_char<_ECharT> {
- using _Str = basic_string<_ECharT, _Traits, _Alloc>;
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
-};
-
-template <class _ECharT, class _Traits>
-struct __is_pathable_string< basic_string_view<_ECharT, _Traits>,
- _Void<typename __can_convert_char<_ECharT>::__char_type> >
- : public __can_convert_char<_ECharT> {
- using _Str = basic_string_view<_ECharT, _Traits>;
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; }
-};
-
-template <class _Source,
- class _DS = __decay_t<_Source>,
- class _UnqualPtrType = __remove_const_t<__remove_pointer_t<_DS> >,
- bool _IsCharPtr = is_pointer<_DS>::value && __can_convert_char<_UnqualPtrType>::value>
-struct __is_pathable_char_array : false_type {};
-
-template <class _Source, class _ECharT, class _UPtr>
-struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> : __can_convert_char<__remove_const_t<_ECharT> > {
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT const* __range_end(const _ECharT* __b) {
- using _Iter = const _ECharT*;
- const _ECharT __sentinel = _ECharT{};
- _Iter __e = __b;
- for (; *__e != __sentinel; ++__e)
- ;
- return __e;
- }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(const _ECharT* __b) { return *__b; }
-};
-
-template <class _Iter, bool _IsIt = __has_input_iterator_category<_Iter>::value, class = void>
-struct __is_pathable_iter : false_type {};
-
-template <class _Iter>
-struct __is_pathable_iter<
- _Iter,
- true,
- _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> >
- : __can_convert_char<typename iterator_traits<_Iter>::value_type> {
- using _ECharT = typename iterator_traits<_Iter>::value_type;
-
- _LIBCPP_HIDE_FROM_ABI static _Iter __range_begin(_Iter __b) { return __b; }
-
- _LIBCPP_HIDE_FROM_ABI static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
-
- _LIBCPP_HIDE_FROM_ABI static _ECharT __first_or_null(_Iter __b) { return *__b; }
-};
-
-template <class _Tp,
- bool _IsStringT = __is_pathable_string<_Tp>::value,
- bool _IsCharIterT = __is_pathable_char_array<_Tp>::value,
- bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value>
-struct __is_pathable : false_type {
- static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false");
-};
-
-template <class _Tp>
-struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {};
-
-template <class _Tp>
-struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {};
-
-template <class _Tp>
-struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {};
-
-# if defined(_LIBCPP_WIN32API)
-typedef wstring __path_string;
-typedef wchar_t __path_value;
-# else
-typedef string __path_string;
-typedef char __path_value;
-# endif
-
-# if defined(_LIBCPP_WIN32API)
-_LIBCPP_EXPORTED_FROM_ABI size_t __wide_to_char(const wstring&, char*, size_t);
-_LIBCPP_EXPORTED_FROM_ABI size_t __char_to_wide(const string&, wchar_t*, size_t);
-# endif
-
-template <class _ECharT>
-struct _PathCVT;
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-template <class _ECharT>
-struct _PathCVT {
- static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible");
-
- typedef __narrow_to_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Narrower;
-# if defined(_LIBCPP_WIN32API)
- typedef __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Widener;
-# endif
-
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _ECharT const* __b, _ECharT const* __e) {
-# if defined(_LIBCPP_WIN32API)
- string __utf8;
- _Narrower()(back_inserter(__utf8), __b, __e);
- _Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-# else
- _Narrower()(back_inserter(__dest), __b, __e);
-# endif
- }
-
- template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
- static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
- if (__b == __e)
- return;
- basic_string<_ECharT> __tmp(__b, __e);
-# if defined(_LIBCPP_WIN32API)
- string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
- _Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-# else
- _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
-# endif
- }
-
- template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
- static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
- const _ECharT __sentinel = _ECharT{};
- if (*__b == __sentinel)
- return;
- basic_string<_ECharT> __tmp;
- for (; *__b != __sentinel; ++__b)
- __tmp.push_back(*__b);
-# if defined(_LIBCPP_WIN32API)
- string __utf8;
- _Narrower()(back_inserter(__utf8), __tmp.data(), __tmp.data() + __tmp.length());
- _Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
-# else
- _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length());
-# endif
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
- using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
- }
-};
-# endif // !_LIBCPP_HAS_NO_LOCALIZATION
-
-template <>
-struct _PathCVT<__path_value> {
- template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
- for (; __b != __e; ++__b)
- __dest.push_back(*__b);
- }
-
- template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
- __dest.append(__b, __e);
- }
-
- template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
- const char __sentinel = char{};
- for (; *__b != __sentinel; ++__b)
- __dest.push_back(*__b);
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
- using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
- }
-};
-
-# if defined(_LIBCPP_WIN32API)
-template <>
-struct _PathCVT<char> {
- _LIBCPP_HIDE_FROM_ABI static void __append_string(__path_string& __dest, const basic_string<char>& __str) {
- size_t __size = __char_to_wide(__str, nullptr, 0);
- size_t __pos = __dest.size();
- __dest.resize(__pos + __size);
- __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
- }
-
- template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
- basic_string<char> __tmp(__b, __e);
- __append_string(__dest, __tmp);
- }
-
- template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
- basic_string<char> __tmp(__b, __e);
- __append_string(__dest, __tmp);
- }
-
- template <class _Iter>
- _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _NullSentinel) {
- const char __sentinel = char{};
- basic_string<char> __tmp;
- for (; *__b != __sentinel; ++__b)
- __tmp.push_back(*__b);
- __append_string(__dest, __tmp);
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI static void __append_source(__path_string& __dest, _Source const& __s) {
- using _Traits = __is_pathable<_Source>;
- __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s));
- }
-};
-
-template <class _ECharT>
-struct _PathExport {
- typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
- typedef __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__> _Widener;
-
- template <class _Str>
- _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
- string __utf8;
- _Narrower()(back_inserter(__utf8), __src.data(), __src.data() + __src.size());
- _Widener()(back_inserter(__dest), __utf8.data(), __utf8.data() + __utf8.size());
- }
-};
-
-template <>
-struct _PathExport<char> {
- template <class _Str>
- _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
- size_t __size = __wide_to_char(__src, nullptr, 0);
- size_t __pos = __dest.size();
- __dest.resize(__size);
- __wide_to_char(__src, const_cast<char*>(__dest.data()) + __pos, __size);
- }
-};
-
-template <>
-struct _PathExport<wchar_t> {
- template <class _Str>
- _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
- __dest.append(__src.begin(), __src.end());
- }
-};
-
-template <>
-struct _PathExport<char16_t> {
- template <class _Str>
- _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
- __dest.append(__src.begin(), __src.end());
- }
-};
-
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
-template <>
-struct _PathExport<char8_t> {
- typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
-
- template <class _Str>
- _LIBCPP_HIDE_FROM_ABI static void __append(_Str& __dest, const __path_string& __src) {
- _Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size());
- }
-};
-# endif /* !_LIBCPP_HAS_NO_CHAR8_T */
-# endif /* _LIBCPP_WIN32API */
-
-class _LIBCPP_EXPORTED_FROM_ABI path {
- template <class _SourceOrIter, class _Tp = path&>
- using _EnableIfPathable = __enable_if_t<__is_pathable<_SourceOrIter>::value, _Tp>;
-
- template <class _Tp>
- using _SourceChar = typename __is_pathable<_Tp>::__char_type;
-
- template <class _Tp>
- using _SourceCVT = _PathCVT<_SourceChar<_Tp> >;
-
-public:
-# if defined(_LIBCPP_WIN32API)
- typedef wchar_t value_type;
- static constexpr value_type preferred_separator = L'\\';
-# else
- typedef char value_type;
- static constexpr value_type preferred_separator = '/';
-# endif
- typedef basic_string<value_type> string_type;
- typedef basic_string_view<value_type> __string_view;
-
- enum format : unsigned char { auto_format, native_format, generic_format };
-
- // constructors and destructor
- _LIBCPP_HIDE_FROM_ABI path() noexcept {}
- _LIBCPP_HIDE_FROM_ABI path(const path& __p) : __pn_(__p.__pn_) {}
- _LIBCPP_HIDE_FROM_ABI path(path&& __p) noexcept : __pn_(std::move(__p.__pn_)) {}
-
- _LIBCPP_HIDE_FROM_ABI path(string_type&& __s, format = format::auto_format) noexcept : __pn_(std::move(__s)) {}
-
- template <class _Source, class = _EnableIfPathable<_Source, void> >
- _LIBCPP_HIDE_FROM_ABI path(const _Source& __src, format = format::auto_format) {
- _SourceCVT<_Source>::__append_source(__pn_, __src);
- }
-
- template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI path(_InputIt __first, _InputIt __last, format = format::auto_format) {
- typedef typename iterator_traits<_InputIt>::value_type _ItVal;
- _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
- }
-
- /*
- #if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- // TODO Implement locale conversions.
- template <class _Source, class = _EnableIfPathable<_Source, void> >
- path(const _Source& __src, const locale& __loc, format = format::auto_format);
- template <class _InputIt>
- path(_InputIt __first, _InputIt _last, const locale& __loc,
- format = format::auto_format);
- #endif
- */
-
- _LIBCPP_HIDE_FROM_ABI ~path() = default;
-
- // assignments
- _LIBCPP_HIDE_FROM_ABI path& operator=(const path& __p) {
- __pn_ = __p.__pn_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator=(path&& __p) noexcept {
- __pn_ = std::move(__p.__pn_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator=(string_type&& __s) noexcept {
- __pn_ = std::move(__s);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept {
- __pn_ = std::move(__s);
- return *this;
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator=(const _Source& __src) {
- return this->assign(__src);
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) {
- __pn_.clear();
- _SourceCVT<_Source>::__append_source(__pn_, __src);
- return *this;
- }
-
- template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) {
- typedef typename iterator_traits<_InputIt>::value_type _ItVal;
- __pn_.clear();
- _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
- return *this;
- }
-
-public:
- // appends
-# if defined(_LIBCPP_WIN32API)
- _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
- auto __p_root_name = __p.__root_name();
- auto __p_root_name_size = __p_root_name.size();
- if (__p.is_absolute() || (!__p_root_name.empty() && __p_root_name != __string_view(root_name().__pn_))) {
- __pn_ = __p.__pn_;
- return *this;
- }
- if (__p.has_root_directory()) {
- path __root_name_str = root_name();
- __pn_ = __root_name_str.native();
- __pn_ += __string_view(__p.__pn_).substr(__p_root_name_size);
- return *this;
- }
- if (has_filename() || (!has_root_directory() && is_absolute()))
- __pn_ += preferred_separator;
- __pn_ += __string_view(__p.__pn_).substr(__p_root_name_size);
- return *this;
- }
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
- return operator/=(path(__src));
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
- return operator/=(path(__src));
- }
-
- template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
- return operator/=(path(__first, __last));
- }
-# else
- _LIBCPP_HIDE_FROM_ABI path& operator/=(const path& __p) {
- if (__p.is_absolute()) {
- __pn_ = __p.__pn_;
- return *this;
- }
- if (has_filename())
- __pn_ += preferred_separator;
- __pn_ += __p.native();
- return *this;
- }
-
- // FIXME: Use _LIBCPP_DIAGNOSE_WARNING to produce a diagnostic when __src
- // is known at compile time to be "/' since the user almost certainly intended
- // to append a separator instead of overwriting the path with "/"
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator/=(const _Source& __src) {
- return this->append(__src);
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
- using _Traits = __is_pathable<_Source>;
- using _CVT = _PathCVT<_SourceChar<_Source> >;
- bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src));
- if (__source_is_absolute)
- __pn_.clear();
- else if (has_filename())
- __pn_ += preferred_separator;
- _CVT::__append_source(__pn_, __src);
- return *this;
- }
-
- template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
- typedef typename iterator_traits<_InputIt>::value_type _ItVal;
- static_assert(__can_convert_char<_ItVal>::value, "Must convertible");
- using _CVT = _PathCVT<_ItVal>;
- if (__first != __last && filesystem::__is_separator(*__first))
- __pn_.clear();
- else if (has_filename())
- __pn_ += preferred_separator;
- _CVT::__append_range(__pn_, __first, __last);
- return *this;
- }
-# endif
-
- // concatenation
- _LIBCPP_HIDE_FROM_ABI path& operator+=(const path& __x) {
- __pn_ += __x.__pn_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator+=(const string_type& __x) {
- __pn_ += __x;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator+=(__string_view __x) {
- __pn_ += __x;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator+=(const value_type* __x) {
- __pn_ += __x;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& operator+=(value_type __x) {
- __pn_ += __x;
- return *this;
- }
-
- template <class _ECharT, __enable_if_t<__can_convert_char<_ECharT>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI path& operator+=(_ECharT __x) {
- _PathCVT<_ECharT>::__append_source(__pn_, basic_string_view<_ECharT>(&__x, 1));
- return *this;
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> operator+=(const _Source& __x) {
- return this->concat(__x);
- }
-
- template <class _Source>
- _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) {
- _SourceCVT<_Source>::__append_source(__pn_, __x);
- return *this;
- }
-
- template <class _InputIt>
- _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) {
- typedef typename iterator_traits<_InputIt>::value_type _ItVal;
- _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
- return *this;
- }
-
- // modifiers
- _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); }
-
- _LIBCPP_HIDE_FROM_ABI path& make_preferred() {
-# if defined(_LIBCPP_WIN32API)
- std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\');
-# endif
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& remove_filename() {
- auto __fname = __filename();
- if (!__fname.empty())
- __pn_.erase(__fname.data() - __pn_.data());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) {
- remove_filename();
- return (*this /= __replacement);
- }
-
- path& replace_extension(const path& __replacement = path());
-
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) == 0;
- }
-# if _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) != 0;
- }
- friend _LIBCPP_HIDE_FROM_ABI bool operator<(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) < 0;
- }
- friend _LIBCPP_HIDE_FROM_ABI bool operator<=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) <= 0;
- }
- friend _LIBCPP_HIDE_FROM_ABI bool operator>(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) > 0;
- }
- friend _LIBCPP_HIDE_FROM_ABI bool operator>=(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) >= 0;
- }
-# else // _LIBCPP_STD_VER <= 17
- friend _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const path& __lhs, const path& __rhs) noexcept {
- return __lhs.__compare(__rhs.__pn_) <=> 0;
- }
-# endif // _LIBCPP_STD_VER <= 17
-
- friend _LIBCPP_HIDE_FROM_ABI path operator/(const path& __lhs, const path& __rhs) {
- path __result(__lhs);
- __result /= __rhs;
- return __result;
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); }
-
- // private helper to allow reserving memory in the path
- _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); }
-
- // native format observers
- _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
-
- _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
-
- _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; }
-
-# if defined(_LIBCPP_WIN32API)
- _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return __pn_; }
-
- _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const {
- std::wstring __s;
- __s.resize(__pn_.size());
- std::replace_copy(__pn_.begin(), __pn_.end(), __s.begin(), '\\', '/');
- return __s;
- }
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
- using _Str = basic_string<_ECharT, _Traits, _Allocator>;
- _Str __s(__a);
- __s.reserve(__pn_.size());
- _PathExport<_ECharT>::__append(__s, __pn_);
- return __s;
- }
-
- _LIBCPP_HIDE_FROM_ABI std::string string() const { return string<char>(); }
- _LIBCPP_HIDE_FROM_ABI __u8_string u8string() const {
- using _CVT = __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
- __u8_string __s;
- __s.reserve(__pn_.size());
- _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size());
- return __s;
- }
-
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
-
- // generic format observers
- template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
- generic_string(const _Allocator& __a = _Allocator()) const {
- using _Str = basic_string<_ECharT, _Traits, _Allocator>;
- _Str __s = string<_ECharT, _Traits, _Allocator>(__a);
- // Note: This (and generic_u8string below) is slightly suboptimal as
- // it iterates twice over the string; once to convert it to the right
- // character type, and once to replace path delimiters.
- std::replace(__s.begin(), __s.end(), static_cast<_ECharT>('\\'), static_cast<_ECharT>('/'));
- return __s;
- }
-
- _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return generic_string<char>(); }
- _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return generic_string<char16_t>(); }
- _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return generic_string<char32_t>(); }
- _LIBCPP_HIDE_FROM_ABI __u8_string generic_u8string() const {
- __u8_string __s = u8string();
- std::replace(__s.begin(), __s.end(), '\\', '/');
- return __s;
- }
-# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-# else /* _LIBCPP_WIN32API */
-
- _LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- _LIBCPP_HIDE_FROM_ABI std::u8string u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-# else
- _LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
-# endif
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const {
- using _CVT = __widen_from_utf8<sizeof(_ECharT) * __CHAR_BIT__>;
- using _Str = basic_string<_ECharT, _Traits, _Allocator>;
- _Str __s(__a);
- __s.reserve(__pn_.size());
- _CVT()(std::back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size());
- return __s;
- }
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI std::wstring wstring() const { return string<wchar_t>(); }
-# endif
- _LIBCPP_HIDE_FROM_ABI std::u16string u16string() const { return string<char16_t>(); }
- _LIBCPP_HIDE_FROM_ABI std::u32string u32string() const { return string<char32_t>(); }
-# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-
- // generic format observers
- _LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- _LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
-# else
- _LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }
-# endif
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> >
- _LIBCPP_HIDE_FROM_ABI basic_string<_ECharT, _Traits, _Allocator>
- generic_string(const _Allocator& __a = _Allocator()) const {
- return string<_ECharT, _Traits, _Allocator>(__a);
- }
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- _LIBCPP_HIDE_FROM_ABI std::wstring generic_wstring() const { return string<wchar_t>(); }
-# endif
- _LIBCPP_HIDE_FROM_ABI std::u16string generic_u16string() const { return string<char16_t>(); }
- _LIBCPP_HIDE_FROM_ABI std::u32string generic_u32string() const { return string<char32_t>(); }
-# endif /* !_LIBCPP_HAS_NO_LOCALIZATION */
-# endif /* !_LIBCPP_WIN32API */
-
-private:
- int __compare(__string_view) const;
- __string_view __root_name() const;
- __string_view __root_directory() const;
- __string_view __root_path_raw() const;
- __string_view __relative_path() const;
- __string_view __parent_path() const;
- __string_view __filename() const;
- __string_view __stem() const;
- __string_view __extension() const;
-
-public:
- // compare
- _LIBCPP_HIDE_FROM_ABI int compare(const path& __p) const noexcept { return __compare(__p.__pn_); }
- _LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return __compare(__s); }
- _LIBCPP_HIDE_FROM_ABI int compare(__string_view __s) const { return __compare(__s); }
- _LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return __compare(__s); }
-
- // decomposition
- _LIBCPP_HIDE_FROM_ABI path root_name() const { return string_type(__root_name()); }
- _LIBCPP_HIDE_FROM_ABI path root_directory() const { return string_type(__root_directory()); }
- _LIBCPP_HIDE_FROM_ABI path root_path() const {
-# if defined(_LIBCPP_WIN32API)
- return string_type(__root_path_raw());
-# else
- return root_name().append(string_type(__root_directory()));
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI path relative_path() const { return string_type(__relative_path()); }
- _LIBCPP_HIDE_FROM_ABI path parent_path() const { return string_type(__parent_path()); }
- _LIBCPP_HIDE_FROM_ABI path filename() const { return string_type(__filename()); }
- _LIBCPP_HIDE_FROM_ABI path stem() const { return string_type(__stem()); }
- _LIBCPP_HIDE_FROM_ABI path extension() const { return string_type(__extension()); }
-
- // query
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __pn_.empty(); }
-
- _LIBCPP_HIDE_FROM_ABI bool has_root_name() const { return !__root_name().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_root_directory() const { return !__root_directory().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_root_path() const { return !__root_path_raw().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_relative_path() const { return !__relative_path().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_parent_path() const { return !__parent_path().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_filename() const { return !__filename().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_stem() const { return !__stem().empty(); }
- _LIBCPP_HIDE_FROM_ABI bool has_extension() const { return !__extension().empty(); }
-
- _LIBCPP_HIDE_FROM_ABI bool is_absolute() const {
-# if defined(_LIBCPP_WIN32API)
- __string_view __root_name_str = __root_name();
- __string_view __root_dir = __root_directory();
- if (__root_name_str.size() == 2 && __root_name_str[1] == ':') {
- // A drive letter with no root directory is relative, e.g. x:example.
- return !__root_dir.empty();
- }
- // If no root name, it's relative, e.g. \example is relative to the current drive
- if (__root_name_str.empty())
- return false;
- if (__root_name_str.size() < 3)
- return false;
- // A server root name, like \\server, is always absolute
- if (__root_name_str[0] != '/' && __root_name_str[0] != '\\')
- return false;
- if (__root_name_str[1] != '/' && __root_name_str[1] != '\\')
- return false;
- // Seems to be a server root name
- return true;
-# else
- return has_root_directory();
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI bool is_relative() const { return !is_absolute(); }
-
- // relative paths
- path lexically_normal() const;
- path lexically_relative(const path& __base) const;
-
- _LIBCPP_HIDE_FROM_ABI path lexically_proximate(const path& __base) const {
- path __result = this->lexically_relative(__base);
- if (__result.native().empty())
- return *this;
- return __result;
- }
-
- // iterators
- class _LIBCPP_EXPORTED_FROM_ABI iterator;
- typedef iterator const_iterator;
-
- iterator begin() const;
- iterator end() const;
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
- template <
- class _CharT,
- class _Traits,
- __enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
- __os << std::__quoted(__p.native());
- return __os;
- }
-
- template <
- class _CharT,
- class _Traits,
- __enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
- __os << std::__quoted(__p.string<_CharT, _Traits>());
- return __os;
- }
-
- template <class _CharT, class _Traits>
- _LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) {
- basic_string<_CharT, _Traits> __tmp;
- __is >> std::__quoted(__tmp);
- __p = __tmp;
- return __is;
- }
-# endif // !_LIBCPP_HAS_NO_LOCALIZATION
-
-private:
- inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) {
- __pn_ = string_type(__s);
- return *this;
- }
- string_type __pn_;
-};
-
-inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
-
-_LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <>
-struct _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY hash<filesystem::path> : __unary_function<filesystem::path, size_t> {
- _LIBCPP_HIDE_FROM_ABI size_t operator()(filesystem::path const& __p) const noexcept {
- return filesystem::hash_value(__p);
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_PATH_H
diff --git a/libcxx/include/__cxx03/__filesystem/path_iterator.h b/libcxx/include/__cxx03/__filesystem/path_iterator.h
deleted file mode 100644
index 121626b4b6ca0..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/path_iterator.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_PATH_ITERATOR_H
-#define _LIBCPP___CXX03___FILESYSTEM_PATH_ITERATOR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
-public:
- enum _ParserState : unsigned char {
- _Singular,
- _BeforeBegin,
- _InRootName,
- _InRootDir,
- _InFilenames,
- _InTrailingSep,
- _AtEnd
- };
-
-public:
- typedef input_iterator_tag iterator_category;
- typedef bidirectional_iterator_tag iterator_concept;
-
- typedef path value_type;
- typedef ptrdiff_t difference_type;
- typedef const path* pointer;
- typedef path reference;
-
-public:
- _LIBCPP_HIDE_FROM_ABI iterator() : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), __state_(_Singular) {}
-
- _LIBCPP_HIDE_FROM_ABI iterator(const iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI ~iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI iterator& operator=(const iterator&) = default;
-
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __stashed_elem_; }
-
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return &__stashed_elem_; }
-
- _LIBCPP_HIDE_FROM_ABI iterator& operator++() {
- _LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to increment a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, "attempting to increment the end iterator");
- return __increment();
- }
-
- _LIBCPP_HIDE_FROM_ABI iterator operator++(int) {
- iterator __it(*this);
- this->operator++();
- return __it;
- }
-
- _LIBCPP_HIDE_FROM_ABI iterator& operator--() {
- _LIBCPP_ASSERT_NON_NULL(__state_ != _Singular, "attempting to decrement a singular iterator");
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator");
- return __decrement();
- }
-
- _LIBCPP_HIDE_FROM_ABI iterator operator--(int) {
- iterator __it(*this);
- this->operator--();
- return __it;
- }
-
-private:
- friend class path;
-
- inline _LIBCPP_HIDE_FROM_ABI friend bool operator==(const iterator&, const iterator&);
-
- iterator& __increment();
- iterator& __decrement();
-
- path __stashed_elem_;
- const path* __path_ptr_;
- path::__string_view __entry_;
- _ParserState __state_;
-};
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) {
- return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data();
-}
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) {
- return !(__lhs == __rhs);
-}
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_PATH_ITERATOR_H
diff --git a/libcxx/include/__cxx03/__filesystem/perm_options.h b/libcxx/include/__cxx03/__filesystem/perm_options.h
deleted file mode 100644
index bebb3038bf6eb..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/perm_options.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_PERM_OPTIONS_H
-#define _LIBCPP___CXX03___FILESYSTEM_PERM_OPTIONS_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
- return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
- return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
- return __lhs = __lhs & __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
- return __lhs = __lhs | __rhs;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
- return __lhs = __lhs ^ __rhs;
-}
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_PERM_OPTIONS_H
diff --git a/libcxx/include/__cxx03/__filesystem/perms.h b/libcxx/include/__cxx03/__filesystem/perms.h
deleted file mode 100644
index 139352c3a8f89..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/perms.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_PERMS_H
-#define _LIBCPP___CXX03___FILESYSTEM_PERMS_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-// On Windows, these permission bits map to one single readonly flag per
-// file, and the executable bit is always returned as set. When setting
-// permissions, as long as the write bit is set for either owner, group or
-// others, the readonly flag is cleared.
-enum class perms : unsigned {
- none = 0,
-
- owner_read = 0400,
- owner_write = 0200,
- owner_exec = 0100,
- owner_all = 0700,
-
- group_read = 040,
- group_write = 020,
- group_exec = 010,
- group_all = 070,
-
- others_read = 04,
- others_write = 02,
- others_exec = 01,
- others_all = 07,
-
- all = 0777,
-
- set_uid = 04000,
- set_gid = 02000,
- sticky_bit = 01000,
- mask = 07777,
- unknown = 0xFFFF,
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
- return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
- return static_cast<perms>(~static_cast<unsigned>(__lhs));
-}
-
-_LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
-
-_LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
-
-_LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_PERMS_H
diff --git a/libcxx/include/__cxx03/__filesystem/recursive_directory_iterator.h b/libcxx/include/__cxx03/__filesystem/recursive_directory_iterator.h
deleted file mode 100644
index a459bd3db4bb2..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/recursive_directory_iterator.h
+++ /dev/null
@@ -1,164 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
-#define _LIBCPP___CXX03___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/directory_entry.h>
-#include <__cxx03/__filesystem/directory_options.h>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/enable_view.h>
-#include <__cxx03/__system_error/error_code.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-class recursive_directory_iterator {
-public:
- using value_type = directory_entry;
- using difference_type = ptrdiff_t;
- using pointer = directory_entry const*;
- using reference = directory_entry const&;
- using iterator_category = input_iterator_tag;
-
-public:
- // constructors and destructor
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator() noexcept : __rec_(false) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit recursive_directory_iterator(
- const path& __p, directory_options __xoptions = directory_options::none)
- : recursive_directory_iterator(__p, __xoptions, nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __xoptions, error_code& __ec)
- : recursive_directory_iterator(__p, __xoptions, &__ec) {}
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const path& __p, error_code& __ec)
- : recursive_directory_iterator(__p, directory_options::none, &__ec) {}
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(const recursive_directory_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator(recursive_directory_iterator&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default;
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator=(recursive_directory_iterator&& __o) noexcept {
- // non-default implementation provided to support self-move assign.
- if (this != &__o) {
- __imp_ = std::move(__o.__imp_);
- __rec_ = __o.__rec_;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~recursive_directory_iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { return __dereference(); }
-
- _LIBCPP_HIDE_FROM_ABI const directory_entry* operator->() const { return &__dereference(); }
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& operator++() { return __increment(); }
-
- _LIBCPP_HIDE_FROM_ABI __dir_element_proxy operator++(int) {
- __dir_element_proxy __p(**this);
- __increment();
- return __p;
- }
-
- _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); }
-
- _LIBCPP_EXPORTED_FROM_ABI directory_options options() const;
- _LIBCPP_EXPORTED_FROM_ABI int depth() const;
-
- _LIBCPP_HIDE_FROM_ABI void pop() { __pop(); }
-
- _LIBCPP_HIDE_FROM_ABI void pop(error_code& __ec) { __pop(&__ec); }
-
- _LIBCPP_HIDE_FROM_ABI bool recursion_pending() const { return __rec_; }
-
- _LIBCPP_HIDE_FROM_ABI void disable_recursion_pending() { __rec_ = false; }
-
-# if _LIBCPP_STD_VER >= 20
-
- _LIBCPP_HIDE_FROM_ABI bool operator==(default_sentinel_t) const noexcept {
- return *this == recursive_directory_iterator();
- }
-
-# endif
-
-private:
- _LIBCPP_EXPORTED_FROM_ABI recursive_directory_iterator(const path& __p, directory_options __opt, error_code* __ec);
- _LIBCPP_EXPORTED_FROM_ABI const directory_entry& __dereference() const;
- _LIBCPP_EXPORTED_FROM_ABI bool __try_recursion(error_code* __ec);
- _LIBCPP_EXPORTED_FROM_ABI void __advance(error_code* __ec = nullptr);
- _LIBCPP_EXPORTED_FROM_ABI recursive_directory_iterator& __increment(error_code* __ec = nullptr);
- _LIBCPP_EXPORTED_FROM_ABI void __pop(error_code* __ec = nullptr);
-
- inline _LIBCPP_HIDE_FROM_ABI friend bool
- operator==(const recursive_directory_iterator&, const recursive_directory_iterator&) noexcept;
-
- struct _LIBCPP_HIDDEN __shared_imp;
- shared_ptr<__shared_imp> __imp_;
- bool __rec_;
-}; // class recursive_directory_iterator
-
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
- return __lhs.__imp_ == __rhs.__imp_;
-}
-
-_LIBCPP_HIDE_FROM_ABI inline bool
-operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept {
- return !(__lhs == __rhs);
-}
-// enable recursive_directory_iterator range-based for statements
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept {
- return __iter;
-}
-
-inline _LIBCPP_HIDE_FROM_ABI recursive_directory_iterator end(recursive_directory_iterator) noexcept {
- return recursive_directory_iterator();
-}
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-# if _LIBCPP_STD_VER >= 20
-
-template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
- std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
-
-template <>
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY inline constexpr bool
- std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
-
-# endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
diff --git a/libcxx/include/__cxx03/__filesystem/space_info.h b/libcxx/include/__cxx03/__filesystem/space_info.h
deleted file mode 100644
index 0a998f87329a8..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/space_info.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_SPACE_INFO_H
-#define _LIBCPP___CXX03___FILESYSTEM_SPACE_INFO_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-struct _LIBCPP_EXPORTED_FROM_ABI space_info {
- uintmax_t capacity;
- uintmax_t free;
- uintmax_t available;
-
-# if _LIBCPP_STD_VER >= 20
- friend _LIBCPP_HIDE_FROM_ABI bool operator==(const space_info&, const space_info&) = default;
-# endif
-};
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_SPACE_INFO_H
diff --git a/libcxx/include/__cxx03/__filesystem/u8path.h b/libcxx/include/__cxx03/__filesystem/u8path.h
deleted file mode 100644
index f60ef6a83f5cc..0000000000000
--- a/libcxx/include/__cxx03/__filesystem/u8path.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FILESYSTEM_U8PATH_H
-#define _LIBCPP___CXX03___FILESYSTEM_U8PATH_H
-
-#include <__cxx03/__algorithm/unwrap_iter.h>
-#include <__cxx03/__config>
-#include <__cxx03/__filesystem/path.h>
-#include <__cxx03/string>
-
-// Only required on Windows for __widen_from_utf8, and included conservatively
-// because it requires support for localization.
-#if defined(_LIBCPP_WIN32API)
-# include <__cxx03/locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
-template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
- static_assert(
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-# endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
- "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
- " or 'char8_t'");
-# if defined(_LIBCPP_WIN32API)
- string __tmp(__f, __l);
- using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
- std::wstring __w;
- __w.reserve(__tmp.size());
- _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
- return path(__w);
-# else
- return path(__f, __l);
-# endif /* !_LIBCPP_WIN32API */
-}
-
-# if defined(_LIBCPP_WIN32API)
-template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
- static_assert(
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
-# endif
- is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
- "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
- " or 'char8_t'");
- string __tmp;
- const char __sentinel = char{};
- for (; *__f != __sentinel; ++__f)
- __tmp.push_back(*__f);
- using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
- std::wstring __w;
- __w.reserve(__tmp.size());
- _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
- return path(__w);
-}
-# endif /* _LIBCPP_WIN32API */
-
-template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
- static_assert(
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
-# endif
- is_same<typename __is_pathable<_Source>::__char_type, char>::value,
- "u8path(Source const&) requires Source have a character type of type "
- "'char' or 'char8_t'");
-# if defined(_LIBCPP_WIN32API)
- using _Traits = __is_pathable<_Source>;
- return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
-# else
- return path(__s);
-# endif
-}
-
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
-_LIBCPP_END_NAMESPACE_FILESYSTEM
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FILESYSTEM_U8PATH_H
diff --git a/libcxx/include/__cxx03/__format/buffer.h b/libcxx/include/__cxx03/__format/buffer.h
deleted file mode 100644
index 167b06d7fd226..0000000000000
--- a/libcxx/include/__cxx03/__format/buffer.h
+++ /dev/null
@@ -1,655 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_BUFFER_H
-#define _LIBCPP___CXX03___FORMAT_BUFFER_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__algorithm/fill_n.h>
-#include <__cxx03/__algorithm/max.h>
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__algorithm/ranges_copy_n.h>
-#include <__cxx03/__algorithm/transform.h>
-#include <__cxx03/__algorithm/unwrap_iter.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/enable_insertable.h>
-#include <__cxx03/__format/format_to_n_result.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/wrap_iter.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/allocate_at_least.h>
-#include <__cxx03/__memory/allocator_traits.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__memory/ranges_construct_at.h>
-#include <__cxx03/__memory/uninitialized_algorithms.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__utility/exception_guard.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format {
-
-/// A "buffer" that handles writing to the proper iterator.
-///
-/// This helper is used together with the @ref back_insert_iterator to offer
-/// type-erasure for the formatting functions. This reduces the number to
-/// template instantiations.
-template <__fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __output_buffer {
-public:
- using value_type = _CharT;
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(_CharT* __ptr, size_t __capacity, _Tp* __obj)
- : __ptr_(__ptr),
- __capacity_(__capacity),
- __flush_([](_CharT* __p, size_t __n, void* __o) { static_cast<_Tp*>(__o)->__flush(__p, __n); }),
- __obj_(__obj) {}
-
- _LIBCPP_HIDE_FROM_ABI void __reset(_CharT* __ptr, size_t __capacity) {
- __ptr_ = __ptr;
- __capacity_ = __capacity;
- }
-
- _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return std::back_insert_iterator{*this}; }
-
- // Used in std::back_insert_iterator.
- _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) {
- __ptr_[__size_++] = __c;
-
- // Profiling showed flushing after adding is more efficient than flushing
- // when entering the function.
- if (__size_ == __capacity_)
- __flush();
- }
-
- /// Copies the input __str to the buffer.
- ///
- /// Since some of the input is generated by std::to_chars, there needs to be a
- /// conversion when _CharT is wchar_t.
- template <__fmt_char_type _InCharT>
- _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) {
- // When the underlying iterator is a simple iterator the __capacity_ is
- // infinite. For a string or container back_inserter it isn't. This means
- // that adding a large string to the buffer can cause some overhead. In that
- // case a better approach could be:
- // - flush the buffer
- // - container.append(__str.begin(), __str.end());
- // The same holds true for the fill.
- // For transform it might be slightly harder, however the use case for
- // transform is slightly less common; it converts hexadecimal values to
- // upper case. For integral these strings are short.
- // TODO FMT Look at the improvements above.
- size_t __n = __str.size();
-
- __flush_on_overflow(__n);
- if (__n < __capacity_) { // push_back requires the buffer to have room for at least one character (so use <).
- std::copy_n(__str.data(), __n, std::addressof(__ptr_[__size_]));
- __size_ += __n;
- return;
- }
-
- // The output doesn't fit in the internal buffer.
- // Copy the data in "__capacity_" sized chunks.
- _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow");
- const _InCharT* __first = __str.data();
- do {
- size_t __chunk = std::min(__n, __capacity_);
- std::copy_n(__first, __chunk, std::addressof(__ptr_[__size_]));
- __size_ = __chunk;
- __first += __chunk;
- __n -= __chunk;
- __flush();
- } while (__n);
- }
-
- /// A std::transform wrapper.
- ///
- /// Like @ref __copy it may need to do type conversion.
- template <contiguous_iterator _Iterator,
- class _UnaryOperation,
- __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
- _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
- _LIBCPP_ASSERT_INTERNAL(__first <= __last, "not a valid range");
-
- size_t __n = static_cast<size_t>(__last - __first);
- __flush_on_overflow(__n);
- if (__n < __capacity_) { // push_back requires the buffer to have room for at least one character (so use <).
- std::transform(__first, __last, std::addressof(__ptr_[__size_]), std::move(__operation));
- __size_ += __n;
- return;
- }
-
- // The output doesn't fit in the internal buffer.
- // Transform the data in "__capacity_" sized chunks.
- _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow");
- do {
- size_t __chunk = std::min(__n, __capacity_);
- std::transform(__first, __first + __chunk, std::addressof(__ptr_[__size_]), __operation);
- __size_ = __chunk;
- __first += __chunk;
- __n -= __chunk;
- __flush();
- } while (__n);
- }
-
- /// A \c fill_n wrapper.
- _LIBCPP_HIDE_FROM_ABI void __fill(size_t __n, _CharT __value) {
- __flush_on_overflow(__n);
- if (__n < __capacity_) { // push_back requires the buffer to have room for at least one character (so use <).
- std::fill_n(std::addressof(__ptr_[__size_]), __n, __value);
- __size_ += __n;
- return;
- }
-
- // The output doesn't fit in the internal buffer.
- // Fill the buffer in "__capacity_" sized chunks.
- _LIBCPP_ASSERT_INTERNAL(__size_ == 0, "the buffer should be flushed by __flush_on_overflow");
- do {
- size_t __chunk = std::min(__n, __capacity_);
- std::fill_n(std::addressof(__ptr_[__size_]), __chunk, __value);
- __size_ = __chunk;
- __n -= __chunk;
- __flush();
- } while (__n);
- }
-
- _LIBCPP_HIDE_FROM_ABI void __flush() {
- __flush_(__ptr_, __size_, __obj_);
- __size_ = 0;
- }
-
-private:
- _CharT* __ptr_;
- size_t __capacity_;
- size_t __size_{0};
- void (*__flush_)(_CharT*, size_t, void*);
- void* __obj_;
-
- /// Flushes the buffer when the output operation would overflow the buffer.
- ///
- /// A simple approach for the overflow detection would be something along the
- /// lines:
- /// \code
- /// // The internal buffer is large enough.
- /// if (__n <= __capacity_) {
- /// // Flush when we really would overflow.
- /// if (__size_ + __n >= __capacity_)
- /// __flush();
- /// ...
- /// }
- /// \endcode
- ///
- /// This approach works for all cases but one:
- /// A __format_to_n_buffer_base where \ref __enable_direct_output is true.
- /// In that case the \ref __capacity_ of the buffer changes during the first
- /// \ref __flush. During that operation the output buffer switches from its
- /// __writer_ to its __storage_. The \ref __capacity_ of the former depends
- /// on the value of n, of the latter is a fixed size. For example:
- /// - a format_to_n call with a 10'000 char buffer,
- /// - the buffer is filled with 9'500 chars,
- /// - adding 1'000 elements would overflow the buffer so the buffer gets
- /// changed and the \ref __capacity_ decreases from 10'000 to
- /// __buffer_size (256 at the time of writing).
- ///
- /// This means that the \ref __flush for this class may need to copy a part of
- /// the internal buffer to the proper output. In this example there will be
- /// 500 characters that need this copy operation.
- ///
- /// Note it would be more efficient to write 500 chars directly and then swap
- /// the buffers. This would make the code more complex and \ref format_to_n is
- /// not the most common use case. Therefore the optimization isn't done.
- _LIBCPP_HIDE_FROM_ABI void __flush_on_overflow(size_t __n) {
- if (__size_ + __n >= __capacity_)
- __flush();
- }
-};
-
-/// A storage using an internal buffer.
-///
-/// This storage is used when writing a single element to the output iterator
-/// is expensive.
-template <__fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __internal_storage {
-public:
- _LIBCPP_HIDE_FROM_ABI _CharT* __begin() { return __buffer_; }
-
- static constexpr size_t __buffer_size = 256 / sizeof(_CharT);
-
-private:
- _CharT __buffer_[__buffer_size];
-};
-
-/// A storage writing directly to the storage.
-///
-/// This requires the storage to be a contiguous buffer of \a _CharT.
-/// Since the output is directly written to the underlying storage this class
-/// is just an empty class.
-template <__fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __direct_storage {};
-
-template <class _OutIt, class _CharT>
-concept __enable_direct_output =
- __fmt_char_type<_CharT> &&
- (same_as<_OutIt, _CharT*>
- // TODO(hardening): the following check might not apply to hardened iterators and might need to be wrapped in an
- // `#ifdef`.
- || same_as<_OutIt, __wrap_iter<_CharT*>>);
-
-/// Write policy for directly writing to the underlying output.
-template <class _OutIt, __fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __writer_direct {
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_direct(_OutIt __out_it) : __out_it_(__out_it) {}
-
- _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() { return __out_it_; }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT*, size_t __n) {
- // _OutIt can be a __wrap_iter<CharT*>. Therefore the original iterator
- // is adjusted.
- __out_it_ += __n;
- }
-
-private:
- _OutIt __out_it_;
-};
-
-/// Write policy for copying the buffer to the output.
-template <class _OutIt, __fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __writer_iterator {
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __writer_iterator(_OutIt __out_it) : __out_it_{std::move(__out_it)} {}
-
- _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { return std::move(__out_it_); }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) {
- __out_it_ = std::ranges::copy_n(__ptr, __n, std::move(__out_it_)).out;
- }
-
-private:
- _OutIt __out_it_;
-};
-
-/// Concept to see whether a \a _Container is insertable.
-///
-/// The concept is used to validate whether multiple calls to a
-/// \ref back_insert_iterator can be replace by a call to \c _Container::insert.
-///
-/// \note a \a _Container needs to opt-in to the concept by specializing
-/// \ref __enable_insertable.
-template <class _Container>
-concept __insertable =
- __enable_insertable<_Container> && __fmt_char_type<typename _Container::value_type> &&
- requires(_Container& __t,
- add_pointer_t<typename _Container::value_type> __first,
- add_pointer_t<typename _Container::value_type> __last) { __t.insert(__t.end(), __first, __last); };
-
-/// Extract the container type of a \ref back_insert_iterator.
-template <class _It>
-struct _LIBCPP_TEMPLATE_VIS __back_insert_iterator_container {
- using type = void;
-};
-
-template <__insertable _Container>
-struct _LIBCPP_TEMPLATE_VIS __back_insert_iterator_container<back_insert_iterator<_Container>> {
- using type = _Container;
-};
-
-/// Write policy for inserting the buffer in a container.
-template <class _Container>
-class _LIBCPP_TEMPLATE_VIS __writer_container {
-public:
- using _CharT = typename _Container::value_type;
-
- _LIBCPP_HIDE_FROM_ABI explicit __writer_container(back_insert_iterator<_Container> __out_it)
- : __container_{__out_it.__get_container()} {}
-
- _LIBCPP_HIDE_FROM_ABI auto __out_it() { return std::back_inserter(*__container_); }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) {
- __container_->insert(__container_->end(), __ptr, __ptr + __n);
- }
-
-private:
- _Container* __container_;
-};
-
-/// Selects the type of the writer used for the output iterator.
-template <class _OutIt, class _CharT>
-class _LIBCPP_TEMPLATE_VIS __writer_selector {
- using _Container = typename __back_insert_iterator_container<_OutIt>::type;
-
-public:
- using type =
- conditional_t<!same_as<_Container, void>,
- __writer_container<_Container>,
- conditional_t<__enable_direct_output<_OutIt, _CharT>,
- __writer_direct<_OutIt, _CharT>,
- __writer_iterator<_OutIt, _CharT>>>;
-};
-
-/// The generic formatting buffer.
-template <class _OutIt, __fmt_char_type _CharT>
- requires(output_iterator<_OutIt, const _CharT&>)
-class _LIBCPP_TEMPLATE_VIS __format_buffer {
- using _Storage =
- conditional_t<__enable_direct_output<_OutIt, _CharT>, __direct_storage<_CharT>, __internal_storage<_CharT>>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
- requires(same_as<_Storage, __internal_storage<_CharT>>)
- : __output_(__storage_.__begin(), __storage_.__buffer_size, this), __writer_(std::move(__out_it)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __format_buffer(_OutIt __out_it)
- requires(same_as<_Storage, __direct_storage<_CharT>>)
- : __output_(std::__unwrap_iter(__out_it), size_t(-1), this), __writer_(std::move(__out_it)) {}
-
- _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) { __writer_.__flush(__ptr, __n); }
-
- _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && {
- __output_.__flush();
- return std::move(__writer_).__out_it();
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _Storage __storage_;
- __output_buffer<_CharT> __output_;
- typename __writer_selector<_OutIt, _CharT>::type __writer_;
-};
-
-/// A buffer that counts the number of insertions.
-///
-/// Since \ref formatted_size only needs to know the size, the output itself is
-/// discarded.
-template <__fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __formatted_size_buffer {
-public:
- _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return __output_.__make_output_iterator(); }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(const _CharT*, size_t __n) { __size_ += __n; }
-
- _LIBCPP_HIDE_FROM_ABI size_t __result() && {
- __output_.__flush();
- return __size_;
- }
-
-private:
- __internal_storage<_CharT> __storage_;
- __output_buffer<_CharT> __output_{__storage_.__begin(), __storage_.__buffer_size, this};
- size_t __size_{0};
-};
-
-/// The base of a buffer that counts and limits the number of insertions.
-template <class _OutIt, __fmt_char_type _CharT, bool>
- requires(output_iterator<_OutIt, const _CharT&>)
-struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base {
- using _Size = iter_difference_t<_OutIt>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __max_size)
- : __writer_(std::move(__out_it)), __max_size_(std::max(_Size(0), __max_size)) {}
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) {
- if (_Size(__size_) <= __max_size_)
- __writer_.__flush(__ptr, std::min(_Size(__n), __max_size_ - __size_));
- __size_ += __n;
- }
-
-protected:
- __internal_storage<_CharT> __storage_;
- __output_buffer<_CharT> __output_{__storage_.__begin(), __storage_.__buffer_size, this};
- typename __writer_selector<_OutIt, _CharT>::type __writer_;
-
- _Size __max_size_;
- _Size __size_{0};
-};
-
-/// The base of a buffer that counts and limits the number of insertions.
-///
-/// This version is used when \c __enable_direct_output<_OutIt, _CharT> == true.
-///
-/// This class limits the size available to the direct writer so it will not
-/// exceed the maximum number of code units.
-template <class _OutIt, __fmt_char_type _CharT>
- requires(output_iterator<_OutIt, const _CharT&>)
-class _LIBCPP_TEMPLATE_VIS __format_to_n_buffer_base<_OutIt, _CharT, true> {
- using _Size = iter_difference_t<_OutIt>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer_base(_OutIt __out_it, _Size __max_size)
- : __output_(std::__unwrap_iter(__out_it), __max_size, this),
- __writer_(std::move(__out_it)),
- __max_size_(__max_size) {
- if (__max_size <= 0) [[unlikely]]
- __output_.__reset(__storage_.__begin(), __storage_.__buffer_size);
- }
-
- _LIBCPP_HIDE_FROM_ABI void __flush(_CharT* __ptr, size_t __n) {
- // A __flush to the direct writer happens in the following occasions:
- // - The format function has written the maximum number of allowed code
- // units. At this point it's no longer valid to write to this writer. So
- // switch to the internal storage. This internal storage doesn't need to
- // be written anywhere so the __flush for that storage writes no output.
- // - Like above, but the next "mass write" operation would overflow the
- // buffer. In that case the buffer is pre-emptively switched. The still
- // valid code units will be written separately.
- // - The format_to_n function is finished. In this case there's no need to
- // switch the buffer, but for simplicity the buffers are still switched.
- // When the __max_size <= 0 the constructor already switched the buffers.
- if (__size_ == 0 && __ptr != __storage_.__begin()) {
- __writer_.__flush(__ptr, __n);
- __output_.__reset(__storage_.__begin(), __storage_.__buffer_size);
- } else if (__size_ < __max_size_) {
- // Copies a part of the internal buffer to the output up to n characters.
- // See __output_buffer<_CharT>::__flush_on_overflow for more information.
- _Size __s = std::min(_Size(__n), __max_size_ - __size_);
- std::copy_n(__ptr, __s, __writer_.__out_it());
- __writer_.__flush(__ptr, __s);
- }
-
- __size_ += __n;
- }
-
-protected:
- __internal_storage<_CharT> __storage_;
- __output_buffer<_CharT> __output_;
- __writer_direct<_OutIt, _CharT> __writer_;
-
- _Size __max_size_;
- _Size __size_{0};
-};
-
-/// The buffer that counts and limits the number of insertions.
-template <class _OutIt, __fmt_char_type _CharT>
- requires(output_iterator<_OutIt, const _CharT&>)
-struct _LIBCPP_TEMPLATE_VIS __format_to_n_buffer final
- : public __format_to_n_buffer_base< _OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>> {
- using _Base = __format_to_n_buffer_base<_OutIt, _CharT, __enable_direct_output<_OutIt, _CharT>>;
- using _Size = iter_difference_t<_OutIt>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __format_to_n_buffer(_OutIt __out_it, _Size __max_size)
- : _Base(std::move(__out_it), __max_size) {}
- _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return this->__output_.__make_output_iterator(); }
-
- _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __result() && {
- this->__output_.__flush();
- return {std::move(this->__writer_).__out_it(), this->__size_};
- }
-};
-
-// A dynamically growing buffer intended to be used for retargeting a context.
-//
-// P2286 Formatting ranges adds range formatting support. It allows the user to
-// specify the minimum width for the entire formatted range. The width of the
-// range is not known until the range is formatted. Formatting is done to an
-// output_iterator so there's no guarantee it would be possible to add the fill
-// to the front of the output. Instead the range is formatted to a temporary
-// buffer and that buffer is formatted as a string.
-//
-// There is an issue with that approach, the format context used in
-// std::formatter<T>::format contains the output iterator used as part of its
-// type. So using this output iterator means there needs to be a new format
-// context and the format arguments need to be retargeted to the new context.
-// This retargeting is done by a basic_format_context specialized for the
-// __iterator of this container.
-//
-// This class uses its own buffer management, since using vector
-// would lead to a circular include with formatter for vector<bool>.
-template <__fmt_char_type _CharT>
-class _LIBCPP_TEMPLATE_VIS __retarget_buffer {
- using _Alloc = allocator<_CharT>;
-
-public:
- using value_type = _CharT;
-
- struct __iterator {
- using difference_type = ptrdiff_t;
- using value_type = _CharT;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(__retarget_buffer& __buffer)
- : __buffer_(std::addressof(__buffer)) {}
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator=(const _CharT& __c) {
- __buffer_->push_back(__c);
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator=(_CharT&& __c) {
- __buffer_->push_back(__c);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator*() { return *this; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { return *this; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { return *this; }
- __retarget_buffer* __buffer_;
- };
-
- __retarget_buffer(const __retarget_buffer&) = delete;
- __retarget_buffer& operator=(const __retarget_buffer&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI explicit __retarget_buffer(size_t __size_hint) {
- // When the initial size is very small a lot of resizes happen
- // when elements added. So use a hard-coded minimum size.
- //
- // Note a size < 2 will not work
- // - 0 there is no buffer, while push_back requires 1 empty element.
- // - 1 multiplied by the grow factor is 1 and thus the buffer never
- // grows.
- auto __result = std::__allocate_at_least(__alloc_, std::max(__size_hint, 256 / sizeof(_CharT)));
- __ptr_ = __result.ptr;
- __capacity_ = __result.count;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__retarget_buffer() {
- ranges::destroy_n(__ptr_, __size_);
- allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __capacity_);
- }
-
- _LIBCPP_HIDE_FROM_ABI __iterator __make_output_iterator() { return __iterator{*this}; }
-
- _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) {
- std::construct_at(__ptr_ + __size_, __c);
- ++__size_;
-
- if (__size_ == __capacity_)
- __grow_buffer();
- }
-
- template <__fmt_char_type _InCharT>
- _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) {
- size_t __n = __str.size();
- if (__size_ + __n >= __capacity_)
- // Push_back requires the buffer to have room for at least one character.
- __grow_buffer(__size_ + __n + 1);
-
- std::uninitialized_copy_n(__str.data(), __n, __ptr_ + __size_);
- __size_ += __n;
- }
-
- template <contiguous_iterator _Iterator,
- class _UnaryOperation,
- __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
- _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
- _LIBCPP_ASSERT_INTERNAL(__first <= __last, "not a valid range");
-
- size_t __n = static_cast<size_t>(__last - __first);
- if (__size_ + __n >= __capacity_)
- // Push_back requires the buffer to have room for at least one character.
- __grow_buffer(__size_ + __n + 1);
-
- std::uninitialized_default_construct_n(__ptr_ + __size_, __n);
- std::transform(__first, __last, __ptr_ + __size_, std::move(__operation));
- __size_ += __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __fill(size_t __n, _CharT __value) {
- if (__size_ + __n >= __capacity_)
- // Push_back requires the buffer to have room for at least one character.
- __grow_buffer(__size_ + __n + 1);
-
- std::uninitialized_fill_n(__ptr_ + __size_, __n, __value);
- __size_ += __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT> __view() { return {__ptr_, __size_}; }
-
-private:
- _LIBCPP_HIDE_FROM_ABI void __grow_buffer() { __grow_buffer(__capacity_ * 1.6); }
-
- _LIBCPP_HIDE_FROM_ABI void __grow_buffer(size_t __capacity) {
- _LIBCPP_ASSERT_INTERNAL(__capacity > __capacity_, "the buffer must grow");
- auto __result = std::__allocate_at_least(__alloc_, __capacity);
- auto __guard = std::__make_exception_guard([&] {
- allocator_traits<_Alloc>::deallocate(__alloc_, __result.ptr, __result.count);
- });
- // This shouldn't throw, but just to be safe. Note that at -O1 this
- // guard is optimized away so there is no runtime overhead.
- std::uninitialized_move_n(__ptr_, __size_, __result.ptr);
- __guard.__complete();
- ranges::destroy_n(__ptr_, __size_);
- allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __capacity_);
-
- __ptr_ = __result.ptr;
- __capacity_ = __result.count;
- }
- _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
- _CharT* __ptr_;
- size_t __capacity_;
- size_t __size_{0};
-};
-
-} // namespace __format
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_BUFFER_H
diff --git a/libcxx/include/__cxx03/__format/concepts.h b/libcxx/include/__cxx03/__format/concepts.h
deleted file mode 100644
index 90fcb7ed0b8f6..0000000000000
--- a/libcxx/include/__cxx03/__format/concepts.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_CONCEPTS_H
-#define _LIBCPP___CXX03___FORMAT_CONCEPTS_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__fwd/format.h>
-#include <__cxx03/__fwd/tuple.h>
-#include <__cxx03/__tuple/tuple_size.h>
-#include <__cxx03/__type_traits/is_specialization.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-/// The character type specializations of \ref formatter.
-template <class _CharT>
-concept __fmt_char_type =
- same_as<_CharT, char>
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- || same_as<_CharT, wchar_t>
-# endif
- ;
-
-// The output iterator isn't specified. A formatter should accept any
-// output_iterator. This iterator is a minimal iterator to test the concept.
-// (Note testing for (w)format_context would be a valid choice, but requires
-// selecting the proper one depending on the type of _CharT.)
-template <class _CharT>
-using __fmt_iter_for = _CharT*;
-
-template <class _Tp, class _Context, class _Formatter = typename _Context::template formatter_type<remove_const_t<_Tp>>>
-concept __formattable_with =
- semiregular<_Formatter> &&
- requires(_Formatter& __f,
- const _Formatter& __cf,
- _Tp&& __t,
- _Context __fc,
- basic_format_parse_context<typename _Context::char_type> __pc) {
- { __f.parse(__pc) } -> same_as<typename decltype(__pc)::iterator>;
- { __cf.format(__t, __fc) } -> same_as<typename _Context::iterator>;
- };
-
-template <class _Tp, class _CharT>
-concept __formattable =
- __formattable_with<remove_reference_t<_Tp>, basic_format_context<__fmt_iter_for<_CharT>, _CharT>>;
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Tp, class _CharT>
-concept formattable = __formattable<_Tp, _CharT>;
-
-// [tuple.like] defines a tuple-like exposition only concept. This concept is
-// not related to that. Therefore it uses a different name for the concept.
-//
-// TODO FMT Add a test to validate we fail when using that concept after P2165
-// has been implemented.
-template <class _Tp>
-concept __fmt_pair_like =
- __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
-
-# endif //_LIBCPP_STD_VER >= 23
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_CONCEPTS_H
diff --git a/libcxx/include/__cxx03/__format/container_adaptor.h b/libcxx/include/__cxx03/__format/container_adaptor.h
deleted file mode 100644
index 42c0d14be61a8..0000000000000
--- a/libcxx/include/__cxx03/__format/container_adaptor.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_CONTAINER_ADAPTOR_H
-#define _LIBCPP___CXX03___FORMAT_CONTAINER_ADAPTOR_H
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/range_default_formatter.h>
-#include <__cxx03/__fwd/queue.h>
-#include <__cxx03/__fwd/stack.h>
-#include <__cxx03/__ranges/ref_view.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-// [container.adaptors.format] only specifies the library should provide the
-// formatter specializations, not which header should provide them.
-// Since <format> includes a lot of headers, add these headers here instead of
-// adding more dependencies like, locale, optinal, string, tuple, etc. to the
-// adaptor headers. To use the format functions users already include <__cxx03/format>.
-
-template <class _Adaptor, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_container_adaptor {
-private:
- using __maybe_const_container = __fmt_maybe_const<typename _Adaptor::container_type, _CharT>;
- using __maybe_const_adaptor = __maybe_const<is_const_v<__maybe_const_container>, _Adaptor>;
- formatter<ranges::ref_view<__maybe_const_container>, _CharT> __underlying_;
-
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(__maybe_const_adaptor& __adaptor, _FormatContext& __ctx) const {
- return __underlying_.format(__adaptor.__get_container(), __ctx);
- }
-};
-
-template <class _CharT, class _Tp, formattable<_CharT> _Container>
-struct _LIBCPP_TEMPLATE_VIS formatter<queue<_Tp, _Container>, _CharT>
- : public __formatter_container_adaptor<queue<_Tp, _Container>, _CharT> {};
-
-template <class _CharT, class _Tp, class _Container, class _Compare>
-struct _LIBCPP_TEMPLATE_VIS formatter<priority_queue<_Tp, _Container, _Compare>, _CharT>
- : public __formatter_container_adaptor<priority_queue<_Tp, _Container, _Compare>, _CharT> {};
-
-template <class _CharT, class _Tp, formattable<_CharT> _Container>
-struct _LIBCPP_TEMPLATE_VIS formatter<stack<_Tp, _Container>, _CharT>
- : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {};
-
-#endif //_LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_CONTAINER_ADAPTOR_H
diff --git a/libcxx/include/__cxx03/__format/enable_insertable.h b/libcxx/include/__cxx03/__format/enable_insertable.h
deleted file mode 100644
index d52ca8cfd442c..0000000000000
--- a/libcxx/include/__cxx03/__format/enable_insertable.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_ENABLE_INSERTABLE_H
-#define _LIBCPP___CXX03___FORMAT_ENABLE_INSERTABLE_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format {
-
-/// Opt-in to enable \ref __insertable for a \a _Container.
-template <class _Container>
-inline constexpr bool __enable_insertable = false;
-
-} // namespace __format
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_ENABLE_INSERTABLE_H
diff --git a/libcxx/include/__cxx03/__format/escaped_output_table.h b/libcxx/include/__cxx03/__format/escaped_output_table.h
deleted file mode 100644
index c5142849865ba..0000000000000
--- a/libcxx/include/__cxx03/__format/escaped_output_table.h
+++ /dev/null
@@ -1,863 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// WARNING, this entire header is generated by
-// utils/generate_escaped_output_table.py
-// DO NOT MODIFY!
-
-// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-//
-// See Terms of Use <https://www.unicode.org/copyright.html>
-// for definitions of Unicode Inc.'s Data Files and Software.
-//
-// NOTICE TO USER: Carefully read the following legal agreement.
-// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
-// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
-// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
-// TERMS AND CONDITIONS OF THIS AGREEMENT.
-// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
-// THE DATA FILES OR SOFTWARE.
-//
-// COPYRIGHT AND PERMISSION NOTICE
-//
-// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved.
-// Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of the Unicode data files and any associated documentation
-// (the "Data Files") or Unicode software and any associated documentation
-// (the "Software") to deal in the Data Files or Software
-// without restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, and/or sell copies of
-// the Data Files or Software, and to permit persons to whom the Data Files
-// or Software are furnished to do so, provided that either
-// (a) this copyright and permission notice appear with all copies
-// of the Data Files or Software, or
-// (b) this copyright and permission notice appear in associated
-// Documentation.
-//
-// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-//
-// Except as contained in this notice, the name of a copyright holder
-// shall not be used in advertising or otherwise to promote the sale,
-// use or other dealings in these Data Files or Software without prior
-// written authorization of the copyright holder.
-
-#ifndef _LIBCPP___CXX03___FORMAT_ESCAPED_OUTPUT_TABLE_H
-#define _LIBCPP___CXX03___FORMAT_ESCAPED_OUTPUT_TABLE_H
-
-#include <__cxx03/__algorithm/ranges_upper_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace __escaped_output_table {
-// clang-format off
-
-/// The entries of the characters to escape in format's debug string.
-///
-/// Contains the entries for [format.string.escaped]/2.2.1.2.1
-/// CE is a Unicode encoding and C corresponds to a UCS scalar value whose
-/// Unicode property General_Category has a value in the groups Separator (Z)
-/// or Other (C), as described by table 12 of UAX #44
-///
-/// Separator (Z) consists of General_Category
-/// - Space_Separator,
-/// - Line_Separator,
-/// - Paragraph_Separator.
-///
-/// Other (C) consists of General_Category
-/// - Control,
-/// - Format,
-/// - Surrogate,
-/// - Private_Use,
-/// - Unassigned.
-///
-/// The data is generated from
-/// - https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedGeneralCategory.txt
-///
-/// The table is similar to the table
-/// __extended_grapheme_custer_property_boundary::__entries
-/// which explains the details of these classes. The only difference is this
-/// table lacks a property, thus having more bits available for the size.
-///
-/// The data has 2 values:
-/// - bits [0, 13] The size of the range, allowing 16384 elements.
-/// - bits [14, 31] The lower bound code point of the range. The upper bound of
-/// the range is lower bound + size. Note the code expects code units the fit
-/// into 18 bits, instead of the 21 bits needed for the full Unicode range.
-_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[711] = {
- 0x00000020 /* 00000000 - 00000020 [ 33] */,
- 0x001fc021 /* 0000007f - 000000a0 [ 34] */,
- 0x002b4000 /* 000000ad - 000000ad [ 1] */,
- 0x00de0001 /* 00000378 - 00000379 [ 2] */,
- 0x00e00003 /* 00000380 - 00000383 [ 4] */,
- 0x00e2c000 /* 0000038b - 0000038b [ 1] */,
- 0x00e34000 /* 0000038d - 0000038d [ 1] */,
- 0x00e88000 /* 000003a2 - 000003a2 [ 1] */,
- 0x014c0000 /* 00000530 - 00000530 [ 1] */,
- 0x0155c001 /* 00000557 - 00000558 [ 2] */,
- 0x0162c001 /* 0000058b - 0000058c [ 2] */,
- 0x01640000 /* 00000590 - 00000590 [ 1] */,
- 0x01720007 /* 000005c8 - 000005cf [ 8] */,
- 0x017ac003 /* 000005eb - 000005ee [ 4] */,
- 0x017d4010 /* 000005f5 - 00000605 [ 17] */,
- 0x01870000 /* 0000061c - 0000061c [ 1] */,
- 0x01b74000 /* 000006dd - 000006dd [ 1] */,
- 0x01c38001 /* 0000070e - 0000070f [ 2] */,
- 0x01d2c001 /* 0000074b - 0000074c [ 2] */,
- 0x01ec800d /* 000007b2 - 000007bf [ 14] */,
- 0x01fec001 /* 000007fb - 000007fc [ 2] */,
- 0x020b8001 /* 0000082e - 0000082f [ 2] */,
- 0x020fc000 /* 0000083f - 0000083f [ 1] */,
- 0x02170001 /* 0000085c - 0000085d [ 2] */,
- 0x0217c000 /* 0000085f - 0000085f [ 1] */,
- 0x021ac004 /* 0000086b - 0000086f [ 5] */,
- 0x0223c008 /* 0000088f - 00000897 [ 9] */,
- 0x02388000 /* 000008e2 - 000008e2 [ 1] */,
- 0x02610000 /* 00000984 - 00000984 [ 1] */,
- 0x02634001 /* 0000098d - 0000098e [ 2] */,
- 0x02644001 /* 00000991 - 00000992 [ 2] */,
- 0x026a4000 /* 000009a9 - 000009a9 [ 1] */,
- 0x026c4000 /* 000009b1 - 000009b1 [ 1] */,
- 0x026cc002 /* 000009b3 - 000009b5 [ 3] */,
- 0x026e8001 /* 000009ba - 000009bb [ 2] */,
- 0x02714001 /* 000009c5 - 000009c6 [ 2] */,
- 0x02724001 /* 000009c9 - 000009ca [ 2] */,
- 0x0273c007 /* 000009cf - 000009d6 [ 8] */,
- 0x02760003 /* 000009d8 - 000009db [ 4] */,
- 0x02778000 /* 000009de - 000009de [ 1] */,
- 0x02790001 /* 000009e4 - 000009e5 [ 2] */,
- 0x027fc001 /* 000009ff - 00000a00 [ 2] */,
- 0x02810000 /* 00000a04 - 00000a04 [ 1] */,
- 0x0282c003 /* 00000a0b - 00000a0e [ 4] */,
- 0x02844001 /* 00000a11 - 00000a12 [ 2] */,
- 0x028a4000 /* 00000a29 - 00000a29 [ 1] */,
- 0x028c4000 /* 00000a31 - 00000a31 [ 1] */,
- 0x028d0000 /* 00000a34 - 00000a34 [ 1] */,
- 0x028dc000 /* 00000a37 - 00000a37 [ 1] */,
- 0x028e8001 /* 00000a3a - 00000a3b [ 2] */,
- 0x028f4000 /* 00000a3d - 00000a3d [ 1] */,
- 0x0290c003 /* 00000a43 - 00000a46 [ 4] */,
- 0x02924001 /* 00000a49 - 00000a4a [ 2] */,
- 0x02938002 /* 00000a4e - 00000a50 [ 3] */,
- 0x02948006 /* 00000a52 - 00000a58 [ 7] */,
- 0x02974000 /* 00000a5d - 00000a5d [ 1] */,
- 0x0297c006 /* 00000a5f - 00000a65 [ 7] */,
- 0x029dc009 /* 00000a77 - 00000a80 [ 10] */,
- 0x02a10000 /* 00000a84 - 00000a84 [ 1] */,
- 0x02a38000 /* 00000a8e - 00000a8e [ 1] */,
- 0x02a48000 /* 00000a92 - 00000a92 [ 1] */,
- 0x02aa4000 /* 00000aa9 - 00000aa9 [ 1] */,
- 0x02ac4000 /* 00000ab1 - 00000ab1 [ 1] */,
- 0x02ad0000 /* 00000ab4 - 00000ab4 [ 1] */,
- 0x02ae8001 /* 00000aba - 00000abb [ 2] */,
- 0x02b18000 /* 00000ac6 - 00000ac6 [ 1] */,
- 0x02b28000 /* 00000aca - 00000aca [ 1] */,
- 0x02b38001 /* 00000ace - 00000acf [ 2] */,
- 0x02b4400e /* 00000ad1 - 00000adf [ 15] */,
- 0x02b90001 /* 00000ae4 - 00000ae5 [ 2] */,
- 0x02bc8006 /* 00000af2 - 00000af8 [ 7] */,
- 0x02c00000 /* 00000b00 - 00000b00 [ 1] */,
- 0x02c10000 /* 00000b04 - 00000b04 [ 1] */,
- 0x02c34001 /* 00000b0d - 00000b0e [ 2] */,
- 0x02c44001 /* 00000b11 - 00000b12 [ 2] */,
- 0x02ca4000 /* 00000b29 - 00000b29 [ 1] */,
- 0x02cc4000 /* 00000b31 - 00000b31 [ 1] */,
- 0x02cd0000 /* 00000b34 - 00000b34 [ 1] */,
- 0x02ce8001 /* 00000b3a - 00000b3b [ 2] */,
- 0x02d14001 /* 00000b45 - 00000b46 [ 2] */,
- 0x02d24001 /* 00000b49 - 00000b4a [ 2] */,
- 0x02d38006 /* 00000b4e - 00000b54 [ 7] */,
- 0x02d60003 /* 00000b58 - 00000b5b [ 4] */,
- 0x02d78000 /* 00000b5e - 00000b5e [ 1] */,
- 0x02d90001 /* 00000b64 - 00000b65 [ 2] */,
- 0x02de0009 /* 00000b78 - 00000b81 [ 10] */,
- 0x02e10000 /* 00000b84 - 00000b84 [ 1] */,
- 0x02e2c002 /* 00000b8b - 00000b8d [ 3] */,
- 0x02e44000 /* 00000b91 - 00000b91 [ 1] */,
- 0x02e58002 /* 00000b96 - 00000b98 [ 3] */,
- 0x02e6c000 /* 00000b9b - 00000b9b [ 1] */,
- 0x02e74000 /* 00000b9d - 00000b9d [ 1] */,
- 0x02e80002 /* 00000ba0 - 00000ba2 [ 3] */,
- 0x02e94002 /* 00000ba5 - 00000ba7 [ 3] */,
- 0x02eac002 /* 00000bab - 00000bad [ 3] */,
- 0x02ee8003 /* 00000bba - 00000bbd [ 4] */,
- 0x02f0c002 /* 00000bc3 - 00000bc5 [ 3] */,
- 0x02f24000 /* 00000bc9 - 00000bc9 [ 1] */,
- 0x02f38001 /* 00000bce - 00000bcf [ 2] */,
- 0x02f44005 /* 00000bd1 - 00000bd6 [ 6] */,
- 0x02f6000d /* 00000bd8 - 00000be5 [ 14] */,
- 0x02fec004 /* 00000bfb - 00000bff [ 5] */,
- 0x03034000 /* 00000c0d - 00000c0d [ 1] */,
- 0x03044000 /* 00000c11 - 00000c11 [ 1] */,
- 0x030a4000 /* 00000c29 - 00000c29 [ 1] */,
- 0x030e8001 /* 00000c3a - 00000c3b [ 2] */,
- 0x03114000 /* 00000c45 - 00000c45 [ 1] */,
- 0x03124000 /* 00000c49 - 00000c49 [ 1] */,
- 0x03138006 /* 00000c4e - 00000c54 [ 7] */,
- 0x0315c000 /* 00000c57 - 00000c57 [ 1] */,
- 0x0316c001 /* 00000c5b - 00000c5c [ 2] */,
- 0x03178001 /* 00000c5e - 00000c5f [ 2] */,
- 0x03190001 /* 00000c64 - 00000c65 [ 2] */,
- 0x031c0006 /* 00000c70 - 00000c76 [ 7] */,
- 0x03234000 /* 00000c8d - 00000c8d [ 1] */,
- 0x03244000 /* 00000c91 - 00000c91 [ 1] */,
- 0x032a4000 /* 00000ca9 - 00000ca9 [ 1] */,
- 0x032d0000 /* 00000cb4 - 00000cb4 [ 1] */,
- 0x032e8001 /* 00000cba - 00000cbb [ 2] */,
- 0x03314000 /* 00000cc5 - 00000cc5 [ 1] */,
- 0x03324000 /* 00000cc9 - 00000cc9 [ 1] */,
- 0x03338006 /* 00000cce - 00000cd4 [ 7] */,
- 0x0335c005 /* 00000cd7 - 00000cdc [ 6] */,
- 0x0337c000 /* 00000cdf - 00000cdf [ 1] */,
- 0x03390001 /* 00000ce4 - 00000ce5 [ 2] */,
- 0x033c0000 /* 00000cf0 - 00000cf0 [ 1] */,
- 0x033d000b /* 00000cf4 - 00000cff [ 12] */,
- 0x03434000 /* 00000d0d - 00000d0d [ 1] */,
- 0x03444000 /* 00000d11 - 00000d11 [ 1] */,
- 0x03514000 /* 00000d45 - 00000d45 [ 1] */,
- 0x03524000 /* 00000d49 - 00000d49 [ 1] */,
- 0x03540003 /* 00000d50 - 00000d53 [ 4] */,
- 0x03590001 /* 00000d64 - 00000d65 [ 2] */,
- 0x03600000 /* 00000d80 - 00000d80 [ 1] */,
- 0x03610000 /* 00000d84 - 00000d84 [ 1] */,
- 0x0365c002 /* 00000d97 - 00000d99 [ 3] */,
- 0x036c8000 /* 00000db2 - 00000db2 [ 1] */,
- 0x036f0000 /* 00000dbc - 00000dbc [ 1] */,
- 0x036f8001 /* 00000dbe - 00000dbf [ 2] */,
- 0x0371c002 /* 00000dc7 - 00000dc9 [ 3] */,
- 0x0372c003 /* 00000dcb - 00000dce [ 4] */,
- 0x03754000 /* 00000dd5 - 00000dd5 [ 1] */,
- 0x0375c000 /* 00000dd7 - 00000dd7 [ 1] */,
- 0x03780005 /* 00000de0 - 00000de5 [ 6] */,
- 0x037c0001 /* 00000df0 - 00000df1 [ 2] */,
- 0x037d400b /* 00000df5 - 00000e00 [ 12] */,
- 0x038ec003 /* 00000e3b - 00000e3e [ 4] */,
- 0x03970024 /* 00000e5c - 00000e80 [ 37] */,
- 0x03a0c000 /* 00000e83 - 00000e83 [ 1] */,
- 0x03a14000 /* 00000e85 - 00000e85 [ 1] */,
- 0x03a2c000 /* 00000e8b - 00000e8b [ 1] */,
- 0x03a90000 /* 00000ea4 - 00000ea4 [ 1] */,
- 0x03a98000 /* 00000ea6 - 00000ea6 [ 1] */,
- 0x03af8001 /* 00000ebe - 00000ebf [ 2] */,
- 0x03b14000 /* 00000ec5 - 00000ec5 [ 1] */,
- 0x03b1c000 /* 00000ec7 - 00000ec7 [ 1] */,
- 0x03b3c000 /* 00000ecf - 00000ecf [ 1] */,
- 0x03b68001 /* 00000eda - 00000edb [ 2] */,
- 0x03b8001f /* 00000ee0 - 00000eff [ 32] */,
- 0x03d20000 /* 00000f48 - 00000f48 [ 1] */,
- 0x03db4003 /* 00000f6d - 00000f70 [ 4] */,
- 0x03e60000 /* 00000f98 - 00000f98 [ 1] */,
- 0x03ef4000 /* 00000fbd - 00000fbd [ 1] */,
- 0x03f34000 /* 00000fcd - 00000fcd [ 1] */,
- 0x03f6c024 /* 00000fdb - 00000fff [ 37] */,
- 0x04318000 /* 000010c6 - 000010c6 [ 1] */,
- 0x04320004 /* 000010c8 - 000010cc [ 5] */,
- 0x04338001 /* 000010ce - 000010cf [ 2] */,
- 0x04924000 /* 00001249 - 00001249 [ 1] */,
- 0x04938001 /* 0000124e - 0000124f [ 2] */,
- 0x0495c000 /* 00001257 - 00001257 [ 1] */,
- 0x04964000 /* 00001259 - 00001259 [ 1] */,
- 0x04978001 /* 0000125e - 0000125f [ 2] */,
- 0x04a24000 /* 00001289 - 00001289 [ 1] */,
- 0x04a38001 /* 0000128e - 0000128f [ 2] */,
- 0x04ac4000 /* 000012b1 - 000012b1 [ 1] */,
- 0x04ad8001 /* 000012b6 - 000012b7 [ 2] */,
- 0x04afc000 /* 000012bf - 000012bf [ 1] */,
- 0x04b04000 /* 000012c1 - 000012c1 [ 1] */,
- 0x04b18001 /* 000012c6 - 000012c7 [ 2] */,
- 0x04b5c000 /* 000012d7 - 000012d7 [ 1] */,
- 0x04c44000 /* 00001311 - 00001311 [ 1] */,
- 0x04c58001 /* 00001316 - 00001317 [ 2] */,
- 0x04d6c001 /* 0000135b - 0000135c [ 2] */,
- 0x04df4002 /* 0000137d - 0000137f [ 3] */,
- 0x04e68005 /* 0000139a - 0000139f [ 6] */,
- 0x04fd8001 /* 000013f6 - 000013f7 [ 2] */,
- 0x04ff8001 /* 000013fe - 000013ff [ 2] */,
- 0x05a00000 /* 00001680 - 00001680 [ 1] */,
- 0x05a74002 /* 0000169d - 0000169f [ 3] */,
- 0x05be4006 /* 000016f9 - 000016ff [ 7] */,
- 0x05c58008 /* 00001716 - 0000171e [ 9] */,
- 0x05cdc008 /* 00001737 - 0000173f [ 9] */,
- 0x05d5000b /* 00001754 - 0000175f [ 12] */,
- 0x05db4000 /* 0000176d - 0000176d [ 1] */,
- 0x05dc4000 /* 00001771 - 00001771 [ 1] */,
- 0x05dd000b /* 00001774 - 0000177f [ 12] */,
- 0x05f78001 /* 000017de - 000017df [ 2] */,
- 0x05fa8005 /* 000017ea - 000017ef [ 6] */,
- 0x05fe8005 /* 000017fa - 000017ff [ 6] */,
- 0x06038000 /* 0000180e - 0000180e [ 1] */,
- 0x06068005 /* 0000181a - 0000181f [ 6] */,
- 0x061e4006 /* 00001879 - 0000187f [ 7] */,
- 0x062ac004 /* 000018ab - 000018af [ 5] */,
- 0x063d8009 /* 000018f6 - 000018ff [ 10] */,
- 0x0647c000 /* 0000191f - 0000191f [ 1] */,
- 0x064b0003 /* 0000192c - 0000192f [ 4] */,
- 0x064f0003 /* 0000193c - 0000193f [ 4] */,
- 0x06504002 /* 00001941 - 00001943 [ 3] */,
- 0x065b8001 /* 0000196e - 0000196f [ 2] */,
- 0x065d400a /* 00001975 - 0000197f [ 11] */,
- 0x066b0003 /* 000019ac - 000019af [ 4] */,
- 0x06728005 /* 000019ca - 000019cf [ 6] */,
- 0x0676c002 /* 000019db - 000019dd [ 3] */,
- 0x06870001 /* 00001a1c - 00001a1d [ 2] */,
- 0x0697c000 /* 00001a5f - 00001a5f [ 1] */,
- 0x069f4001 /* 00001a7d - 00001a7e [ 2] */,
- 0x06a28005 /* 00001a8a - 00001a8f [ 6] */,
- 0x06a68005 /* 00001a9a - 00001a9f [ 6] */,
- 0x06ab8001 /* 00001aae - 00001aaf [ 2] */,
- 0x06b3c030 /* 00001acf - 00001aff [ 49] */,
- 0x06d34002 /* 00001b4d - 00001b4f [ 3] */,
- 0x06dfc000 /* 00001b7f - 00001b7f [ 1] */,
- 0x06fd0007 /* 00001bf4 - 00001bfb [ 8] */,
- 0x070e0002 /* 00001c38 - 00001c3a [ 3] */,
- 0x07128002 /* 00001c4a - 00001c4c [ 3] */,
- 0x07224006 /* 00001c89 - 00001c8f [ 7] */,
- 0x072ec001 /* 00001cbb - 00001cbc [ 2] */,
- 0x07320007 /* 00001cc8 - 00001ccf [ 8] */,
- 0x073ec004 /* 00001cfb - 00001cff [ 5] */,
- 0x07c58001 /* 00001f16 - 00001f17 [ 2] */,
- 0x07c78001 /* 00001f1e - 00001f1f [ 2] */,
- 0x07d18001 /* 00001f46 - 00001f47 [ 2] */,
- 0x07d38001 /* 00001f4e - 00001f4f [ 2] */,
- 0x07d60000 /* 00001f58 - 00001f58 [ 1] */,
- 0x07d68000 /* 00001f5a - 00001f5a [ 1] */,
- 0x07d70000 /* 00001f5c - 00001f5c [ 1] */,
- 0x07d78000 /* 00001f5e - 00001f5e [ 1] */,
- 0x07df8001 /* 00001f7e - 00001f7f [ 2] */,
- 0x07ed4000 /* 00001fb5 - 00001fb5 [ 1] */,
- 0x07f14000 /* 00001fc5 - 00001fc5 [ 1] */,
- 0x07f50001 /* 00001fd4 - 00001fd5 [ 2] */,
- 0x07f70000 /* 00001fdc - 00001fdc [ 1] */,
- 0x07fc0001 /* 00001ff0 - 00001ff1 [ 2] */,
- 0x07fd4000 /* 00001ff5 - 00001ff5 [ 1] */,
- 0x07ffc010 /* 00001fff - 0000200f [ 17] */,
- 0x080a0007 /* 00002028 - 0000202f [ 8] */,
- 0x0817c010 /* 0000205f - 0000206f [ 17] */,
- 0x081c8001 /* 00002072 - 00002073 [ 2] */,
- 0x0823c000 /* 0000208f - 0000208f [ 1] */,
- 0x08274002 /* 0000209d - 0000209f [ 3] */,
- 0x0830400e /* 000020c1 - 000020cf [ 15] */,
- 0x083c400e /* 000020f1 - 000020ff [ 15] */,
- 0x08630003 /* 0000218c - 0000218f [ 4] */,
- 0x0909c018 /* 00002427 - 0000243f [ 25] */,
- 0x0912c014 /* 0000244b - 0000245f [ 21] */,
- 0x0add0001 /* 00002b74 - 00002b75 [ 2] */,
- 0x0ae58000 /* 00002b96 - 00002b96 [ 1] */,
- 0x0b3d0004 /* 00002cf4 - 00002cf8 [ 5] */,
- 0x0b498000 /* 00002d26 - 00002d26 [ 1] */,
- 0x0b4a0004 /* 00002d28 - 00002d2c [ 5] */,
- 0x0b4b8001 /* 00002d2e - 00002d2f [ 2] */,
- 0x0b5a0006 /* 00002d68 - 00002d6e [ 7] */,
- 0x0b5c400d /* 00002d71 - 00002d7e [ 14] */,
- 0x0b65c008 /* 00002d97 - 00002d9f [ 9] */,
- 0x0b69c000 /* 00002da7 - 00002da7 [ 1] */,
- 0x0b6bc000 /* 00002daf - 00002daf [ 1] */,
- 0x0b6dc000 /* 00002db7 - 00002db7 [ 1] */,
- 0x0b6fc000 /* 00002dbf - 00002dbf [ 1] */,
- 0x0b71c000 /* 00002dc7 - 00002dc7 [ 1] */,
- 0x0b73c000 /* 00002dcf - 00002dcf [ 1] */,
- 0x0b75c000 /* 00002dd7 - 00002dd7 [ 1] */,
- 0x0b77c000 /* 00002ddf - 00002ddf [ 1] */,
- 0x0b978021 /* 00002e5e - 00002e7f [ 34] */,
- 0x0ba68000 /* 00002e9a - 00002e9a [ 1] */,
- 0x0bbd000b /* 00002ef4 - 00002eff [ 12] */,
- 0x0bf58019 /* 00002fd6 - 00002fef [ 26] */,
- 0x0c000000 /* 00003000 - 00003000 [ 1] */,
- 0x0c100000 /* 00003040 - 00003040 [ 1] */,
- 0x0c25c001 /* 00003097 - 00003098 [ 2] */,
- 0x0c400004 /* 00003100 - 00003104 [ 5] */,
- 0x0c4c0000 /* 00003130 - 00003130 [ 1] */,
- 0x0c63c000 /* 0000318f - 0000318f [ 1] */,
- 0x0c79000a /* 000031e4 - 000031ee [ 11] */,
- 0x0c87c000 /* 0000321f - 0000321f [ 1] */,
- 0x29234002 /* 0000a48d - 0000a48f [ 3] */,
- 0x2931c008 /* 0000a4c7 - 0000a4cf [ 9] */,
- 0x298b0013 /* 0000a62c - 0000a63f [ 20] */,
- 0x29be0007 /* 0000a6f8 - 0000a6ff [ 8] */,
- 0x29f2c004 /* 0000a7cb - 0000a7cf [ 5] */,
- 0x29f48000 /* 0000a7d2 - 0000a7d2 [ 1] */,
- 0x29f50000 /* 0000a7d4 - 0000a7d4 [ 1] */,
- 0x29f68017 /* 0000a7da - 0000a7f1 [ 24] */,
- 0x2a0b4002 /* 0000a82d - 0000a82f [ 3] */,
- 0x2a0e8005 /* 0000a83a - 0000a83f [ 6] */,
- 0x2a1e0007 /* 0000a878 - 0000a87f [ 8] */,
- 0x2a318007 /* 0000a8c6 - 0000a8cd [ 8] */,
- 0x2a368005 /* 0000a8da - 0000a8df [ 6] */,
- 0x2a55000a /* 0000a954 - 0000a95e [ 11] */,
- 0x2a5f4002 /* 0000a97d - 0000a97f [ 3] */,
- 0x2a738000 /* 0000a9ce - 0000a9ce [ 1] */,
- 0x2a768003 /* 0000a9da - 0000a9dd [ 4] */,
- 0x2a7fc000 /* 0000a9ff - 0000a9ff [ 1] */,
- 0x2a8dc008 /* 0000aa37 - 0000aa3f [ 9] */,
- 0x2a938001 /* 0000aa4e - 0000aa4f [ 2] */,
- 0x2a968001 /* 0000aa5a - 0000aa5b [ 2] */,
- 0x2ab0c017 /* 0000aac3 - 0000aada [ 24] */,
- 0x2abdc009 /* 0000aaf7 - 0000ab00 [ 10] */,
- 0x2ac1c001 /* 0000ab07 - 0000ab08 [ 2] */,
- 0x2ac3c001 /* 0000ab0f - 0000ab10 [ 2] */,
- 0x2ac5c008 /* 0000ab17 - 0000ab1f [ 9] */,
- 0x2ac9c000 /* 0000ab27 - 0000ab27 [ 1] */,
- 0x2acbc000 /* 0000ab2f - 0000ab2f [ 1] */,
- 0x2adb0003 /* 0000ab6c - 0000ab6f [ 4] */,
- 0x2afb8001 /* 0000abee - 0000abef [ 2] */,
- 0x2afe8005 /* 0000abfa - 0000abff [ 6] */,
- 0x35e9000b /* 0000d7a4 - 0000d7af [ 12] */,
- 0x35f1c003 /* 0000d7c7 - 0000d7ca [ 4] */,
- 0x35ff2103 /* 0000d7fc - 0000f8ff [ 8452] */,
- 0x3e9b8001 /* 0000fa6e - 0000fa6f [ 2] */,
- 0x3eb68025 /* 0000fada - 0000faff [ 38] */,
- 0x3ec1c00b /* 0000fb07 - 0000fb12 [ 12] */,
- 0x3ec60004 /* 0000fb18 - 0000fb1c [ 5] */,
- 0x3ecdc000 /* 0000fb37 - 0000fb37 [ 1] */,
- 0x3ecf4000 /* 0000fb3d - 0000fb3d [ 1] */,
- 0x3ecfc000 /* 0000fb3f - 0000fb3f [ 1] */,
- 0x3ed08000 /* 0000fb42 - 0000fb42 [ 1] */,
- 0x3ed14000 /* 0000fb45 - 0000fb45 [ 1] */,
- 0x3ef0c00f /* 0000fbc3 - 0000fbd2 [ 16] */,
- 0x3f640001 /* 0000fd90 - 0000fd91 [ 2] */,
- 0x3f720006 /* 0000fdc8 - 0000fdce [ 7] */,
- 0x3f74001f /* 0000fdd0 - 0000fdef [ 32] */,
- 0x3f868005 /* 0000fe1a - 0000fe1f [ 6] */,
- 0x3f94c000 /* 0000fe53 - 0000fe53 [ 1] */,
- 0x3f99c000 /* 0000fe67 - 0000fe67 [ 1] */,
- 0x3f9b0003 /* 0000fe6c - 0000fe6f [ 4] */,
- 0x3f9d4000 /* 0000fe75 - 0000fe75 [ 1] */,
- 0x3fbf4003 /* 0000fefd - 0000ff00 [ 4] */,
- 0x3fefc002 /* 0000ffbf - 0000ffc1 [ 3] */,
- 0x3ff20001 /* 0000ffc8 - 0000ffc9 [ 2] */,
- 0x3ff40001 /* 0000ffd0 - 0000ffd1 [ 2] */,
- 0x3ff60001 /* 0000ffd8 - 0000ffd9 [ 2] */,
- 0x3ff74002 /* 0000ffdd - 0000ffdf [ 3] */,
- 0x3ff9c000 /* 0000ffe7 - 0000ffe7 [ 1] */,
- 0x3ffbc00c /* 0000ffef - 0000fffb [ 13] */,
- 0x3fff8001 /* 0000fffe - 0000ffff [ 2] */,
- 0x40030000 /* 0001000c - 0001000c [ 1] */,
- 0x4009c000 /* 00010027 - 00010027 [ 1] */,
- 0x400ec000 /* 0001003b - 0001003b [ 1] */,
- 0x400f8000 /* 0001003e - 0001003e [ 1] */,
- 0x40138001 /* 0001004e - 0001004f [ 2] */,
- 0x40178021 /* 0001005e - 0001007f [ 34] */,
- 0x403ec004 /* 000100fb - 000100ff [ 5] */,
- 0x4040c003 /* 00010103 - 00010106 [ 4] */,
- 0x404d0002 /* 00010134 - 00010136 [ 3] */,
- 0x4063c000 /* 0001018f - 0001018f [ 1] */,
- 0x40674002 /* 0001019d - 0001019f [ 3] */,
- 0x4068402e /* 000101a1 - 000101cf [ 47] */,
- 0x407f8081 /* 000101fe - 0001027f [ 130] */,
- 0x40a74002 /* 0001029d - 0001029f [ 3] */,
- 0x40b4400e /* 000102d1 - 000102df [ 15] */,
- 0x40bf0003 /* 000102fc - 000102ff [ 4] */,
- 0x40c90008 /* 00010324 - 0001032c [ 9] */,
- 0x40d2c004 /* 0001034b - 0001034f [ 5] */,
- 0x40dec004 /* 0001037b - 0001037f [ 5] */,
- 0x40e78000 /* 0001039e - 0001039e [ 1] */,
- 0x40f10003 /* 000103c4 - 000103c7 [ 4] */,
- 0x40f58029 /* 000103d6 - 000103ff [ 42] */,
- 0x41278001 /* 0001049e - 0001049f [ 2] */,
- 0x412a8005 /* 000104aa - 000104af [ 6] */,
- 0x41350003 /* 000104d4 - 000104d7 [ 4] */,
- 0x413f0003 /* 000104fc - 000104ff [ 4] */,
- 0x414a0007 /* 00010528 - 0001052f [ 8] */,
- 0x4159000a /* 00010564 - 0001056e [ 11] */,
- 0x415ec000 /* 0001057b - 0001057b [ 1] */,
- 0x4162c000 /* 0001058b - 0001058b [ 1] */,
- 0x4164c000 /* 00010593 - 00010593 [ 1] */,
- 0x41658000 /* 00010596 - 00010596 [ 1] */,
- 0x41688000 /* 000105a2 - 000105a2 [ 1] */,
- 0x416c8000 /* 000105b2 - 000105b2 [ 1] */,
- 0x416e8000 /* 000105ba - 000105ba [ 1] */,
- 0x416f4042 /* 000105bd - 000105ff [ 67] */,
- 0x41cdc008 /* 00010737 - 0001073f [ 9] */,
- 0x41d58009 /* 00010756 - 0001075f [ 10] */,
- 0x41da0017 /* 00010768 - 0001077f [ 24] */,
- 0x41e18000 /* 00010786 - 00010786 [ 1] */,
- 0x41ec4000 /* 000107b1 - 000107b1 [ 1] */,
- 0x41eec044 /* 000107bb - 000107ff [ 69] */,
- 0x42018001 /* 00010806 - 00010807 [ 2] */,
- 0x42024000 /* 00010809 - 00010809 [ 1] */,
- 0x420d8000 /* 00010836 - 00010836 [ 1] */,
- 0x420e4002 /* 00010839 - 0001083b [ 3] */,
- 0x420f4001 /* 0001083d - 0001083e [ 2] */,
- 0x42158000 /* 00010856 - 00010856 [ 1] */,
- 0x4227c007 /* 0001089f - 000108a6 [ 8] */,
- 0x422c002f /* 000108b0 - 000108df [ 48] */,
- 0x423cc000 /* 000108f3 - 000108f3 [ 1] */,
- 0x423d8004 /* 000108f6 - 000108fa [ 5] */,
- 0x42470002 /* 0001091c - 0001091e [ 3] */,
- 0x424e8004 /* 0001093a - 0001093e [ 5] */,
- 0x4250003f /* 00010940 - 0001097f [ 64] */,
- 0x426e0003 /* 000109b8 - 000109bb [ 4] */,
- 0x42740001 /* 000109d0 - 000109d1 [ 2] */,
- 0x42810000 /* 00010a04 - 00010a04 [ 1] */,
- 0x4281c004 /* 00010a07 - 00010a0b [ 5] */,
- 0x42850000 /* 00010a14 - 00010a14 [ 1] */,
- 0x42860000 /* 00010a18 - 00010a18 [ 1] */,
- 0x428d8001 /* 00010a36 - 00010a37 [ 2] */,
- 0x428ec003 /* 00010a3b - 00010a3e [ 4] */,
- 0x42924006 /* 00010a49 - 00010a4f [ 7] */,
- 0x42964006 /* 00010a59 - 00010a5f [ 7] */,
- 0x42a8001f /* 00010aa0 - 00010abf [ 32] */,
- 0x42b9c003 /* 00010ae7 - 00010aea [ 4] */,
- 0x42bdc008 /* 00010af7 - 00010aff [ 9] */,
- 0x42cd8002 /* 00010b36 - 00010b38 [ 3] */,
- 0x42d58001 /* 00010b56 - 00010b57 [ 2] */,
- 0x42dcc004 /* 00010b73 - 00010b77 [ 5] */,
- 0x42e48006 /* 00010b92 - 00010b98 [ 7] */,
- 0x42e7400b /* 00010b9d - 00010ba8 [ 12] */,
- 0x42ec004f /* 00010bb0 - 00010bff [ 80] */,
- 0x43124036 /* 00010c49 - 00010c7f [ 55] */,
- 0x432cc00c /* 00010cb3 - 00010cbf [ 13] */,
- 0x433cc006 /* 00010cf3 - 00010cf9 [ 7] */,
- 0x434a0007 /* 00010d28 - 00010d2f [ 8] */,
- 0x434e8125 /* 00010d3a - 00010e5f [ 294] */,
- 0x439fc000 /* 00010e7f - 00010e7f [ 1] */,
- 0x43aa8000 /* 00010eaa - 00010eaa [ 1] */,
- 0x43ab8001 /* 00010eae - 00010eaf [ 2] */,
- 0x43ac804a /* 00010eb2 - 00010efc [ 75] */,
- 0x43ca0007 /* 00010f28 - 00010f2f [ 8] */,
- 0x43d68015 /* 00010f5a - 00010f6f [ 22] */,
- 0x43e28025 /* 00010f8a - 00010faf [ 38] */,
- 0x43f30013 /* 00010fcc - 00010fdf [ 20] */,
- 0x43fdc008 /* 00010ff7 - 00010fff [ 9] */,
- 0x44138003 /* 0001104e - 00011051 [ 4] */,
- 0x441d8008 /* 00011076 - 0001107e [ 9] */,
- 0x442f4000 /* 000110bd - 000110bd [ 1] */,
- 0x4430c00c /* 000110c3 - 000110cf [ 13] */,
- 0x443a4006 /* 000110e9 - 000110ef [ 7] */,
- 0x443e8005 /* 000110fa - 000110ff [ 6] */,
- 0x444d4000 /* 00011135 - 00011135 [ 1] */,
- 0x44520007 /* 00011148 - 0001114f [ 8] */,
- 0x445dc008 /* 00011177 - 0001117f [ 9] */,
- 0x44780000 /* 000111e0 - 000111e0 [ 1] */,
- 0x447d400a /* 000111f5 - 000111ff [ 11] */,
- 0x44848000 /* 00011212 - 00011212 [ 1] */,
- 0x4490803d /* 00011242 - 0001127f [ 62] */,
- 0x44a1c000 /* 00011287 - 00011287 [ 1] */,
- 0x44a24000 /* 00011289 - 00011289 [ 1] */,
- 0x44a38000 /* 0001128e - 0001128e [ 1] */,
- 0x44a78000 /* 0001129e - 0001129e [ 1] */,
- 0x44aa8005 /* 000112aa - 000112af [ 6] */,
- 0x44bac004 /* 000112eb - 000112ef [ 5] */,
- 0x44be8005 /* 000112fa - 000112ff [ 6] */,
- 0x44c10000 /* 00011304 - 00011304 [ 1] */,
- 0x44c34001 /* 0001130d - 0001130e [ 2] */,
- 0x44c44001 /* 00011311 - 00011312 [ 2] */,
- 0x44ca4000 /* 00011329 - 00011329 [ 1] */,
- 0x44cc4000 /* 00011331 - 00011331 [ 1] */,
- 0x44cd0000 /* 00011334 - 00011334 [ 1] */,
- 0x44ce8000 /* 0001133a - 0001133a [ 1] */,
- 0x44d14001 /* 00011345 - 00011346 [ 2] */,
- 0x44d24001 /* 00011349 - 0001134a [ 2] */,
- 0x44d38001 /* 0001134e - 0001134f [ 2] */,
- 0x44d44005 /* 00011351 - 00011356 [ 6] */,
- 0x44d60004 /* 00011358 - 0001135c [ 5] */,
- 0x44d90001 /* 00011364 - 00011365 [ 2] */,
- 0x44db4002 /* 0001136d - 0001136f [ 3] */,
- 0x44dd408a /* 00011375 - 000113ff [ 139] */,
- 0x45170000 /* 0001145c - 0001145c [ 1] */,
- 0x4518801d /* 00011462 - 0001147f [ 30] */,
- 0x45320007 /* 000114c8 - 000114cf [ 8] */,
- 0x453680a5 /* 000114da - 0001157f [ 166] */,
- 0x456d8001 /* 000115b6 - 000115b7 [ 2] */,
- 0x45778021 /* 000115de - 000115ff [ 34] */,
- 0x4591400a /* 00011645 - 0001164f [ 11] */,
- 0x45968005 /* 0001165a - 0001165f [ 6] */,
- 0x459b4012 /* 0001166d - 0001167f [ 19] */,
- 0x45ae8005 /* 000116ba - 000116bf [ 6] */,
- 0x45b28035 /* 000116ca - 000116ff [ 54] */,
- 0x45c6c001 /* 0001171b - 0001171c [ 2] */,
- 0x45cb0003 /* 0001172c - 0001172f [ 4] */,
- 0x45d1c0b8 /* 00011747 - 000117ff [ 185] */,
- 0x460f0063 /* 0001183c - 0001189f [ 100] */,
- 0x463cc00b /* 000118f3 - 000118fe [ 12] */,
- 0x4641c001 /* 00011907 - 00011908 [ 2] */,
- 0x46428001 /* 0001190a - 0001190b [ 2] */,
- 0x46450000 /* 00011914 - 00011914 [ 1] */,
- 0x4645c000 /* 00011917 - 00011917 [ 1] */,
- 0x464d8000 /* 00011936 - 00011936 [ 1] */,
- 0x464e4001 /* 00011939 - 0001193a [ 2] */,
- 0x4651c008 /* 00011947 - 0001194f [ 9] */,
- 0x46568045 /* 0001195a - 0001199f [ 70] */,
- 0x466a0001 /* 000119a8 - 000119a9 [ 2] */,
- 0x46760001 /* 000119d8 - 000119d9 [ 2] */,
- 0x4679401a /* 000119e5 - 000119ff [ 27] */,
- 0x46920007 /* 00011a48 - 00011a4f [ 8] */,
- 0x46a8c00c /* 00011aa3 - 00011aaf [ 13] */,
- 0x46be4006 /* 00011af9 - 00011aff [ 7] */,
- 0x46c280f5 /* 00011b0a - 00011bff [ 246] */,
- 0x47024000 /* 00011c09 - 00011c09 [ 1] */,
- 0x470dc000 /* 00011c37 - 00011c37 [ 1] */,
- 0x47118009 /* 00011c46 - 00011c4f [ 10] */,
- 0x471b4002 /* 00011c6d - 00011c6f [ 3] */,
- 0x47240001 /* 00011c90 - 00011c91 [ 2] */,
- 0x472a0000 /* 00011ca8 - 00011ca8 [ 1] */,
- 0x472dc048 /* 00011cb7 - 00011cff [ 73] */,
- 0x4741c000 /* 00011d07 - 00011d07 [ 1] */,
- 0x47428000 /* 00011d0a - 00011d0a [ 1] */,
- 0x474dc002 /* 00011d37 - 00011d39 [ 3] */,
- 0x474ec000 /* 00011d3b - 00011d3b [ 1] */,
- 0x474f8000 /* 00011d3e - 00011d3e [ 1] */,
- 0x47520007 /* 00011d48 - 00011d4f [ 8] */,
- 0x47568005 /* 00011d5a - 00011d5f [ 6] */,
- 0x47598000 /* 00011d66 - 00011d66 [ 1] */,
- 0x475a4000 /* 00011d69 - 00011d69 [ 1] */,
- 0x4763c000 /* 00011d8f - 00011d8f [ 1] */,
- 0x47648000 /* 00011d92 - 00011d92 [ 1] */,
- 0x47664006 /* 00011d99 - 00011d9f [ 7] */,
- 0x476a8135 /* 00011daa - 00011edf [ 310] */,
- 0x47be4006 /* 00011ef9 - 00011eff [ 7] */,
- 0x47c44000 /* 00011f11 - 00011f11 [ 1] */,
- 0x47cec002 /* 00011f3b - 00011f3d [ 3] */,
- 0x47d68055 /* 00011f5a - 00011faf [ 86] */,
- 0x47ec400e /* 00011fb1 - 00011fbf [ 15] */,
- 0x47fc800c /* 00011ff2 - 00011ffe [ 13] */,
- 0x48e68065 /* 0001239a - 000123ff [ 102] */,
- 0x491bc000 /* 0001246f - 0001246f [ 1] */,
- 0x491d400a /* 00012475 - 0001247f [ 11] */,
- 0x49510a4b /* 00012544 - 00012f8f [ 2636] */,
- 0x4bfcc00c /* 00012ff3 - 00012fff [ 13] */,
- 0x4d0c000f /* 00013430 - 0001343f [ 16] */,
- 0x4d158fa9 /* 00013456 - 000143ff [ 4010] */,
- 0x5191e1b8 /* 00014647 - 000167ff [ 8633] */,
- 0x5a8e4006 /* 00016a39 - 00016a3f [ 7] */,
- 0x5a97c000 /* 00016a5f - 00016a5f [ 1] */,
- 0x5a9a8003 /* 00016a6a - 00016a6d [ 4] */,
- 0x5aafc000 /* 00016abf - 00016abf [ 1] */,
- 0x5ab28005 /* 00016aca - 00016acf [ 6] */,
- 0x5abb8001 /* 00016aee - 00016aef [ 2] */,
- 0x5abd8009 /* 00016af6 - 00016aff [ 10] */,
- 0x5ad18009 /* 00016b46 - 00016b4f [ 10] */,
- 0x5ad68000 /* 00016b5a - 00016b5a [ 1] */,
- 0x5ad88000 /* 00016b62 - 00016b62 [ 1] */,
- 0x5ade0004 /* 00016b78 - 00016b7c [ 5] */,
- 0x5ae402af /* 00016b90 - 00016e3f [ 688] */,
- 0x5ba6c064 /* 00016e9b - 00016eff [ 101] */,
- 0x5bd2c003 /* 00016f4b - 00016f4e [ 4] */,
- 0x5be20006 /* 00016f88 - 00016f8e [ 7] */,
- 0x5be8003f /* 00016fa0 - 00016fdf [ 64] */,
- 0x5bf9400a /* 00016fe5 - 00016fef [ 11] */,
- 0x5bfc800d /* 00016ff2 - 00016fff [ 14] */,
- 0x61fe0007 /* 000187f8 - 000187ff [ 8] */,
- 0x63358029 /* 00018cd6 - 00018cff [ 42] */,
- 0x634262e6 /* 00018d09 - 0001afef [ 8935] */,
- 0x6bfd0000 /* 0001aff4 - 0001aff4 [ 1] */,
- 0x6bff0000 /* 0001affc - 0001affc [ 1] */,
- 0x6bffc000 /* 0001afff - 0001afff [ 1] */,
- 0x6c48c00e /* 0001b123 - 0001b131 [ 15] */,
- 0x6c4cc01c /* 0001b133 - 0001b14f [ 29] */,
- 0x6c54c001 /* 0001b153 - 0001b154 [ 2] */,
- 0x6c55800d /* 0001b156 - 0001b163 [ 14] */,
- 0x6c5a0007 /* 0001b168 - 0001b16f [ 8] */,
- 0x6cbf0903 /* 0001b2fc - 0001bbff [ 2308] */,
- 0x6f1ac004 /* 0001bc6b - 0001bc6f [ 5] */,
- 0x6f1f4002 /* 0001bc7d - 0001bc7f [ 3] */,
- 0x6f224006 /* 0001bc89 - 0001bc8f [ 7] */,
- 0x6f268001 /* 0001bc9a - 0001bc9b [ 2] */,
- 0x6f28125f /* 0001bca0 - 0001ceff [ 4704] */,
- 0x73cb8001 /* 0001cf2e - 0001cf2f [ 2] */,
- 0x73d1c008 /* 0001cf47 - 0001cf4f [ 9] */,
- 0x73f1003b /* 0001cfc4 - 0001cfff [ 60] */,
- 0x743d8009 /* 0001d0f6 - 0001d0ff [ 10] */,
- 0x7449c001 /* 0001d127 - 0001d128 [ 2] */,
- 0x745cc007 /* 0001d173 - 0001d17a [ 8] */,
- 0x747ac014 /* 0001d1eb - 0001d1ff [ 21] */,
- 0x74918079 /* 0001d246 - 0001d2bf [ 122] */,
- 0x74b5000b /* 0001d2d4 - 0001d2df [ 12] */,
- 0x74bd000b /* 0001d2f4 - 0001d2ff [ 12] */,
- 0x74d5c008 /* 0001d357 - 0001d35f [ 9] */,
- 0x74de4086 /* 0001d379 - 0001d3ff [ 135] */,
- 0x75154000 /* 0001d455 - 0001d455 [ 1] */,
- 0x75274000 /* 0001d49d - 0001d49d [ 1] */,
- 0x75280001 /* 0001d4a0 - 0001d4a1 [ 2] */,
- 0x7528c001 /* 0001d4a3 - 0001d4a4 [ 2] */,
- 0x7529c001 /* 0001d4a7 - 0001d4a8 [ 2] */,
- 0x752b4000 /* 0001d4ad - 0001d4ad [ 1] */,
- 0x752e8000 /* 0001d4ba - 0001d4ba [ 1] */,
- 0x752f0000 /* 0001d4bc - 0001d4bc [ 1] */,
- 0x75310000 /* 0001d4c4 - 0001d4c4 [ 1] */,
- 0x75418000 /* 0001d506 - 0001d506 [ 1] */,
- 0x7542c001 /* 0001d50b - 0001d50c [ 2] */,
- 0x75454000 /* 0001d515 - 0001d515 [ 1] */,
- 0x75474000 /* 0001d51d - 0001d51d [ 1] */,
- 0x754e8000 /* 0001d53a - 0001d53a [ 1] */,
- 0x754fc000 /* 0001d53f - 0001d53f [ 1] */,
- 0x75514000 /* 0001d545 - 0001d545 [ 1] */,
- 0x7551c002 /* 0001d547 - 0001d549 [ 3] */,
- 0x75544000 /* 0001d551 - 0001d551 [ 1] */,
- 0x75a98001 /* 0001d6a6 - 0001d6a7 [ 2] */,
- 0x75f30001 /* 0001d7cc - 0001d7cd [ 2] */,
- 0x76a3000e /* 0001da8c - 0001da9a [ 15] */,
- 0x76a80000 /* 0001daa0 - 0001daa0 [ 1] */,
- 0x76ac044f /* 0001dab0 - 0001deff [ 1104] */,
- 0x77c7c005 /* 0001df1f - 0001df24 [ 6] */,
- 0x77cac0d4 /* 0001df2b - 0001dfff [ 213] */,
- 0x7801c000 /* 0001e007 - 0001e007 [ 1] */,
- 0x78064001 /* 0001e019 - 0001e01a [ 2] */,
- 0x78088000 /* 0001e022 - 0001e022 [ 1] */,
- 0x78094000 /* 0001e025 - 0001e025 [ 1] */,
- 0x780ac004 /* 0001e02b - 0001e02f [ 5] */,
- 0x781b8020 /* 0001e06e - 0001e08e [ 33] */,
- 0x7824006f /* 0001e090 - 0001e0ff [ 112] */,
- 0x784b4002 /* 0001e12d - 0001e12f [ 3] */,
- 0x784f8001 /* 0001e13e - 0001e13f [ 2] */,
- 0x78528003 /* 0001e14a - 0001e14d [ 4] */,
- 0x7854013f /* 0001e150 - 0001e28f [ 320] */,
- 0x78abc010 /* 0001e2af - 0001e2bf [ 17] */,
- 0x78be8004 /* 0001e2fa - 0001e2fe [ 5] */,
- 0x78c001cf /* 0001e300 - 0001e4cf [ 464] */,
- 0x793e82e5 /* 0001e4fa - 0001e7df [ 742] */,
- 0x79f9c000 /* 0001e7e7 - 0001e7e7 [ 1] */,
- 0x79fb0000 /* 0001e7ec - 0001e7ec [ 1] */,
- 0x79fbc000 /* 0001e7ef - 0001e7ef [ 1] */,
- 0x79ffc000 /* 0001e7ff - 0001e7ff [ 1] */,
- 0x7a314001 /* 0001e8c5 - 0001e8c6 [ 2] */,
- 0x7a35c028 /* 0001e8d7 - 0001e8ff [ 41] */,
- 0x7a530003 /* 0001e94c - 0001e94f [ 4] */,
- 0x7a568003 /* 0001e95a - 0001e95d [ 4] */,
- 0x7a580310 /* 0001e960 - 0001ec70 [ 785] */,
- 0x7b2d404b /* 0001ecb5 - 0001ed00 [ 76] */,
- 0x7b4f80c1 /* 0001ed3e - 0001edff [ 194] */,
- 0x7b810000 /* 0001ee04 - 0001ee04 [ 1] */,
- 0x7b880000 /* 0001ee20 - 0001ee20 [ 1] */,
- 0x7b88c000 /* 0001ee23 - 0001ee23 [ 1] */,
- 0x7b894001 /* 0001ee25 - 0001ee26 [ 2] */,
- 0x7b8a0000 /* 0001ee28 - 0001ee28 [ 1] */,
- 0x7b8cc000 /* 0001ee33 - 0001ee33 [ 1] */,
- 0x7b8e0000 /* 0001ee38 - 0001ee38 [ 1] */,
- 0x7b8e8000 /* 0001ee3a - 0001ee3a [ 1] */,
- 0x7b8f0005 /* 0001ee3c - 0001ee41 [ 6] */,
- 0x7b90c003 /* 0001ee43 - 0001ee46 [ 4] */,
- 0x7b920000 /* 0001ee48 - 0001ee48 [ 1] */,
- 0x7b928000 /* 0001ee4a - 0001ee4a [ 1] */,
- 0x7b930000 /* 0001ee4c - 0001ee4c [ 1] */,
- 0x7b940000 /* 0001ee50 - 0001ee50 [ 1] */,
- 0x7b94c000 /* 0001ee53 - 0001ee53 [ 1] */,
- 0x7b954001 /* 0001ee55 - 0001ee56 [ 2] */,
- 0x7b960000 /* 0001ee58 - 0001ee58 [ 1] */,
- 0x7b968000 /* 0001ee5a - 0001ee5a [ 1] */,
- 0x7b970000 /* 0001ee5c - 0001ee5c [ 1] */,
- 0x7b978000 /* 0001ee5e - 0001ee5e [ 1] */,
- 0x7b980000 /* 0001ee60 - 0001ee60 [ 1] */,
- 0x7b98c000 /* 0001ee63 - 0001ee63 [ 1] */,
- 0x7b994001 /* 0001ee65 - 0001ee66 [ 2] */,
- 0x7b9ac000 /* 0001ee6b - 0001ee6b [ 1] */,
- 0x7b9cc000 /* 0001ee73 - 0001ee73 [ 1] */,
- 0x7b9e0000 /* 0001ee78 - 0001ee78 [ 1] */,
- 0x7b9f4000 /* 0001ee7d - 0001ee7d [ 1] */,
- 0x7b9fc000 /* 0001ee7f - 0001ee7f [ 1] */,
- 0x7ba28000 /* 0001ee8a - 0001ee8a [ 1] */,
- 0x7ba70004 /* 0001ee9c - 0001eea0 [ 5] */,
- 0x7ba90000 /* 0001eea4 - 0001eea4 [ 1] */,
- 0x7baa8000 /* 0001eeaa - 0001eeaa [ 1] */,
- 0x7baf0033 /* 0001eebc - 0001eeef [ 52] */,
- 0x7bbc810d /* 0001eef2 - 0001efff [ 270] */,
- 0x7c0b0003 /* 0001f02c - 0001f02f [ 4] */,
- 0x7c25000b /* 0001f094 - 0001f09f [ 12] */,
- 0x7c2bc001 /* 0001f0af - 0001f0b0 [ 2] */,
- 0x7c300000 /* 0001f0c0 - 0001f0c0 [ 1] */,
- 0x7c340000 /* 0001f0d0 - 0001f0d0 [ 1] */,
- 0x7c3d8009 /* 0001f0f6 - 0001f0ff [ 10] */,
- 0x7c6b8037 /* 0001f1ae - 0001f1e5 [ 56] */,
- 0x7c80c00c /* 0001f203 - 0001f20f [ 13] */,
- 0x7c8f0003 /* 0001f23c - 0001f23f [ 4] */,
- 0x7c924006 /* 0001f249 - 0001f24f [ 7] */,
- 0x7c94800d /* 0001f252 - 0001f25f [ 14] */,
- 0x7c998099 /* 0001f266 - 0001f2ff [ 154] */,
- 0x7db60003 /* 0001f6d8 - 0001f6db [ 4] */,
- 0x7dbb4002 /* 0001f6ed - 0001f6ef [ 3] */,
- 0x7dbf4002 /* 0001f6fd - 0001f6ff [ 3] */,
- 0x7dddc003 /* 0001f777 - 0001f77a [ 4] */,
- 0x7df68005 /* 0001f7da - 0001f7df [ 6] */,
- 0x7dfb0003 /* 0001f7ec - 0001f7ef [ 4] */,
- 0x7dfc400e /* 0001f7f1 - 0001f7ff [ 15] */,
- 0x7e030003 /* 0001f80c - 0001f80f [ 4] */,
- 0x7e120007 /* 0001f848 - 0001f84f [ 8] */,
- 0x7e168005 /* 0001f85a - 0001f85f [ 6] */,
- 0x7e220007 /* 0001f888 - 0001f88f [ 8] */,
- 0x7e2b8001 /* 0001f8ae - 0001f8af [ 2] */,
- 0x7e2c804d /* 0001f8b2 - 0001f8ff [ 78] */,
- 0x7e95000b /* 0001fa54 - 0001fa5f [ 12] */,
- 0x7e9b8001 /* 0001fa6e - 0001fa6f [ 2] */,
- 0x7e9f4002 /* 0001fa7d - 0001fa7f [ 3] */,
- 0x7ea24006 /* 0001fa89 - 0001fa8f [ 7] */,
- 0x7eaf8000 /* 0001fabe - 0001fabe [ 1] */,
- 0x7eb18007 /* 0001fac6 - 0001facd [ 8] */,
- 0x7eb70003 /* 0001fadc - 0001fadf [ 4] */,
- 0x7eba4006 /* 0001fae9 - 0001faef [ 7] */,
- 0x7ebe4006 /* 0001faf9 - 0001faff [ 7] */,
- 0x7ee4c000 /* 0001fb93 - 0001fb93 [ 1] */,
- 0x7ef2c024 /* 0001fbcb - 0001fbef [ 37] */,
- 0x7efe8405 /* 0001fbfa - 0001ffff [ 1030] */,
- 0xa9b8001f /* 0002a6e0 - 0002a6ff [ 32] */,
- 0xadce8005 /* 0002b73a - 0002b73f [ 6] */,
- 0xae078001 /* 0002b81e - 0002b81f [ 2] */,
- 0xb3a8800d /* 0002cea2 - 0002ceaf [ 14] */,
- 0xbaf8400e /* 0002ebe1 - 0002ebef [ 15] */,
- 0xbb9789a1 /* 0002ee5e - 0002f7ff [ 2466] */,
- 0xbe8785e1 /* 0002fa1e - 0002ffff [ 1506] */,
- 0xc4d2c004 /* 0003134b - 0003134f [ 5] */};
-
-/// Returns whether the code unit needs to be escaped.
-///
-/// At the end of the valid Unicode code points space a lot of code points are
-/// either reserved or a noncharacter. Adding all these entries to the
-/// lookup table would greatly increase the size of the table. Instead these
-/// entries are manually processed. In this large area of reserved code points,
-/// there is a small area of extended graphemes that should not be escaped
-/// unconditionally. This is also manually coded. See the generation script for
-/// more details.
-
-///
-/// \\pre The code point is a valid Unicode code point.
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __needs_escape(const char32_t __code_point) noexcept {
-
- // The entries in the gap at the end.
- if(__code_point >= 0x000e0100 && __code_point <= 0x000e01ef)
- return false;
-
- // The entries at the end.
- if (__code_point >= 0x000323b0)
- return true;
-
- ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
- if (__i == 0)
- return false;
-
- --__i;
- uint32_t __upper_bound = (__entries[__i] >> 14) + (__entries[__i] & 0x3fffu);
- return __code_point <= __upper_bound;
-}
-
-// clang-format on
-} // namespace __escaped_output_table
-
-#endif //_LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_ESCAPED_OUTPUT_TABLE_H
diff --git a/libcxx/include/__cxx03/__format/extended_grapheme_cluster_table.h b/libcxx/include/__cxx03/__format/extended_grapheme_cluster_table.h
deleted file mode 100644
index c26b870d30378..0000000000000
--- a/libcxx/include/__cxx03/__format/extended_grapheme_cluster_table.h
+++ /dev/null
@@ -1,1663 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// WARNING, this entire header is generated by
-// utils/generate_extended_grapheme_cluster_table.py
-// DO NOT MODIFY!
-
-// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-//
-// See Terms of Use <https://www.unicode.org/copyright.html>
-// for definitions of Unicode Inc.'s Data Files and Software.
-//
-// NOTICE TO USER: Carefully read the following legal agreement.
-// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
-// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
-// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
-// TERMS AND CONDITIONS OF THIS AGREEMENT.
-// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
-// THE DATA FILES OR SOFTWARE.
-//
-// COPYRIGHT AND PERMISSION NOTICE
-//
-// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved.
-// Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of the Unicode data files and any associated documentation
-// (the "Data Files") or Unicode software and any associated documentation
-// (the "Software") to deal in the Data Files or Software
-// without restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, and/or sell copies of
-// the Data Files or Software, and to permit persons to whom the Data Files
-// or Software are furnished to do so, provided that either
-// (a) this copyright and permission notice appear with all copies
-// of the Data Files or Software, or
-// (b) this copyright and permission notice appear in associated
-// Documentation.
-//
-// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-//
-// Except as contained in this notice, the name of a copyright holder
-// shall not be used in advertising or otherwise to promote the sale,
-// use or other dealings in these Data Files or Software without prior
-// written authorization of the copyright holder.
-
-#ifndef _LIBCPP___CXX03___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
-#define _LIBCPP___CXX03___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
-
-#include <__cxx03/__algorithm/ranges_upper_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/access.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __extended_grapheme_custer_property_boundary {
-
-enum class __property : uint8_t {
- // Values generated from the data files.
- __CR,
- __Control,
- __Extend,
- __Extended_Pictographic,
- __L,
- __LF,
- __LV,
- __LVT,
- __Prepend,
- __Regional_Indicator,
- __SpacingMark,
- __T,
- __V,
- __ZWJ,
-
- // The properies below aren't stored in the "database".
-
- // Text position properties.
- __sot,
- __eot,
-
- // The code unit has none of above properties.
- __none
-};
-
-/// The entries of the extended grapheme cluster bondary property table.
-///
-/// The data is generated from
-/// - https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
-/// - https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
-///
-/// The data has 3 values
-/// - bits [0, 3] The property. One of the values generated from the datafiles
-/// of \ref __property
-/// - bits [4, 10] The size of the range.
-/// - bits [11, 31] The lower bound code point of the range. The upper bound of
-/// the range is lower bound + size.
-///
-/// The 7 bits for the size allow a maximum range of 128 elements. Some ranges
-/// in the Unicode tables are larger. They are stored in multiple consecutive
-/// ranges in the data table. An alternative would be to store the sizes in a
-/// separate 16-bit value. The original MSVC STL code had such an approach, but
-/// this approach uses less space for the data and is about 4% faster in the
-/// following benchmark.
-/// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
-// clang-format off
-_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[1496] = {
- 0x00000091,
- 0x00005005,
- 0x00005811,
- 0x00006800,
- 0x00007111,
- 0x0003fa01,
- 0x00054803,
- 0x00056801,
- 0x00057003,
- 0x001806f2,
- 0x00241862,
- 0x002c8ac2,
- 0x002df802,
- 0x002e0812,
- 0x002e2012,
- 0x002e3802,
- 0x00300058,
- 0x003080a2,
- 0x0030e001,
- 0x00325942,
- 0x00338002,
- 0x0036b062,
- 0x0036e808,
- 0x0036f852,
- 0x00373812,
- 0x00375032,
- 0x00387808,
- 0x00388802,
- 0x003981a2,
- 0x003d30a2,
- 0x003f5882,
- 0x003fe802,
- 0x0040b032,
- 0x0040d882,
- 0x00412822,
- 0x00414842,
- 0x0042c822,
- 0x00448018,
- 0x0044c072,
- 0x00465172,
- 0x00471008,
- 0x004719f2,
- 0x0048180a,
- 0x0049d002,
- 0x0049d80a,
- 0x0049e002,
- 0x0049f02a,
- 0x004a0872,
- 0x004a483a,
- 0x004a6802,
- 0x004a701a,
- 0x004a8862,
- 0x004b1012,
- 0x004c0802,
- 0x004c101a,
- 0x004de002,
- 0x004df002,
- 0x004df81a,
- 0x004e0832,
- 0x004e381a,
- 0x004e581a,
- 0x004e6802,
- 0x004eb802,
- 0x004f1012,
- 0x004ff002,
- 0x00500812,
- 0x0050180a,
- 0x0051e002,
- 0x0051f02a,
- 0x00520812,
- 0x00523812,
- 0x00525822,
- 0x00528802,
- 0x00538012,
- 0x0053a802,
- 0x00540812,
- 0x0054180a,
- 0x0055e002,
- 0x0055f02a,
- 0x00560842,
- 0x00563812,
- 0x0056480a,
- 0x0056581a,
- 0x00566802,
- 0x00571012,
- 0x0057d052,
- 0x00580802,
- 0x0058101a,
- 0x0059e002,
- 0x0059f012,
- 0x005a000a,
- 0x005a0832,
- 0x005a381a,
- 0x005a581a,
- 0x005a6802,
- 0x005aa822,
- 0x005b1012,
- 0x005c1002,
- 0x005df002,
- 0x005df80a,
- 0x005e0002,
- 0x005e081a,
- 0x005e302a,
- 0x005e502a,
- 0x005e6802,
- 0x005eb802,
- 0x00600002,
- 0x0060082a,
- 0x00602002,
- 0x0061e002,
- 0x0061f022,
- 0x0062083a,
- 0x00623022,
- 0x00625032,
- 0x0062a812,
- 0x00631012,
- 0x00640802,
- 0x0064101a,
- 0x0065e002,
- 0x0065f00a,
- 0x0065f802,
- 0x0066001a,
- 0x00661002,
- 0x0066181a,
- 0x00663002,
- 0x0066381a,
- 0x0066501a,
- 0x00666012,
- 0x0066a812,
- 0x00671012,
- 0x0067980a,
- 0x00680012,
- 0x0068101a,
- 0x0069d812,
- 0x0069f002,
- 0x0069f81a,
- 0x006a0832,
- 0x006a302a,
- 0x006a502a,
- 0x006a6802,
- 0x006a7008,
- 0x006ab802,
- 0x006b1012,
- 0x006c0802,
- 0x006c101a,
- 0x006e5002,
- 0x006e7802,
- 0x006e801a,
- 0x006e9022,
- 0x006eb002,
- 0x006ec06a,
- 0x006ef802,
- 0x006f901a,
- 0x00718802,
- 0x0071980a,
- 0x0071a062,
- 0x00723872,
- 0x00758802,
- 0x0075980a,
- 0x0075a082,
- 0x00764062,
- 0x0078c012,
- 0x0079a802,
- 0x0079b802,
- 0x0079c802,
- 0x0079f01a,
- 0x007b88d2,
- 0x007bf80a,
- 0x007c0042,
- 0x007c3012,
- 0x007c68a2,
- 0x007cca32,
- 0x007e3002,
- 0x00816832,
- 0x0081880a,
- 0x00819052,
- 0x0081c812,
- 0x0081d81a,
- 0x0081e812,
- 0x0082b01a,
- 0x0082c012,
- 0x0082f022,
- 0x00838832,
- 0x00841002,
- 0x0084200a,
- 0x00842812,
- 0x00846802,
- 0x0084e802,
- 0x008805f4,
- 0x008b047c,
- 0x008d457b,
- 0x009ae822,
- 0x00b89022,
- 0x00b8a80a,
- 0x00b99012,
- 0x00b9a00a,
- 0x00ba9012,
- 0x00bb9012,
- 0x00bda012,
- 0x00bdb00a,
- 0x00bdb862,
- 0x00bdf07a,
- 0x00be3002,
- 0x00be381a,
- 0x00be48a2,
- 0x00bee802,
- 0x00c05822,
- 0x00c07001,
- 0x00c07802,
- 0x00c42812,
- 0x00c54802,
- 0x00c90022,
- 0x00c9183a,
- 0x00c93812,
- 0x00c9482a,
- 0x00c9801a,
- 0x00c99002,
- 0x00c9985a,
- 0x00c9c822,
- 0x00d0b812,
- 0x00d0c81a,
- 0x00d0d802,
- 0x00d2a80a,
- 0x00d2b002,
- 0x00d2b80a,
- 0x00d2c062,
- 0x00d30002,
- 0x00d31002,
- 0x00d32872,
- 0x00d3685a,
- 0x00d39892,
- 0x00d3f802,
- 0x00d581e2,
- 0x00d80032,
- 0x00d8200a,
- 0x00d9a062,
- 0x00d9d80a,
- 0x00d9e002,
- 0x00d9e84a,
- 0x00da1002,
- 0x00da181a,
- 0x00db5882,
- 0x00dc0012,
- 0x00dc100a,
- 0x00dd080a,
- 0x00dd1032,
- 0x00dd301a,
- 0x00dd4012,
- 0x00dd500a,
- 0x00dd5822,
- 0x00df3002,
- 0x00df380a,
- 0x00df4012,
- 0x00df502a,
- 0x00df6802,
- 0x00df700a,
- 0x00df7822,
- 0x00df901a,
- 0x00e1207a,
- 0x00e16072,
- 0x00e1a01a,
- 0x00e1b012,
- 0x00e68022,
- 0x00e6a0c2,
- 0x00e7080a,
- 0x00e71062,
- 0x00e76802,
- 0x00e7a002,
- 0x00e7b80a,
- 0x00e7c012,
- 0x00ee03f2,
- 0x01005801,
- 0x01006002,
- 0x0100680d,
- 0x01007011,
- 0x01014061,
- 0x0101e003,
- 0x01024803,
- 0x010300f1,
- 0x01068202,
- 0x01091003,
- 0x0109c803,
- 0x010ca053,
- 0x010d4813,
- 0x0118d013,
- 0x01194003,
- 0x011c4003,
- 0x011e7803,
- 0x011f48a3,
- 0x011fc023,
- 0x01261003,
- 0x012d5013,
- 0x012db003,
- 0x012e0003,
- 0x012fd833,
- 0x01300053,
- 0x013038b3,
- 0x0130a713,
- 0x01348753,
- 0x013840a3,
- 0x0138a003,
- 0x0138b003,
- 0x0138e803,
- 0x01390803,
- 0x01394003,
- 0x01399813,
- 0x013a2003,
- 0x013a3803,
- 0x013a6003,
- 0x013a7003,
- 0x013a9823,
- 0x013ab803,
- 0x013b1843,
- 0x013ca823,
- 0x013d0803,
- 0x013d8003,
- 0x013df803,
- 0x0149a013,
- 0x01582823,
- 0x0158d813,
- 0x015a8003,
- 0x015aa803,
- 0x01677822,
- 0x016bf802,
- 0x016f01f2,
- 0x01815052,
- 0x01818003,
- 0x0181e803,
- 0x0184c812,
- 0x0194b803,
- 0x0194c803,
- 0x05337832,
- 0x0533a092,
- 0x0534f012,
- 0x05378012,
- 0x05401002,
- 0x05403002,
- 0x05405802,
- 0x0541181a,
- 0x05412812,
- 0x0541380a,
- 0x05416002,
- 0x0544001a,
- 0x0545a0fa,
- 0x05462012,
- 0x05470112,
- 0x0547f802,
- 0x05493072,
- 0x054a38a2,
- 0x054a901a,
- 0x054b01c4,
- 0x054c0022,
- 0x054c180a,
- 0x054d9802,
- 0x054da01a,
- 0x054db032,
- 0x054dd01a,
- 0x054de012,
- 0x054df02a,
- 0x054f2802,
- 0x05514852,
- 0x0551781a,
- 0x05518812,
- 0x0551981a,
- 0x0551a812,
- 0x05521802,
- 0x05526002,
- 0x0552680a,
- 0x0553e002,
- 0x05558002,
- 0x05559022,
- 0x0555b812,
- 0x0555f012,
- 0x05560802,
- 0x0557580a,
- 0x05576012,
- 0x0557701a,
- 0x0557a80a,
- 0x0557b002,
- 0x055f181a,
- 0x055f2802,
- 0x055f301a,
- 0x055f4002,
- 0x055f481a,
- 0x055f600a,
- 0x055f6802,
- 0x05600006,
- 0x056009a7,
- 0x0560e006,
- 0x0560e9a7,
- 0x0561c006,
- 0x0561c9a7,
- 0x0562a006,
- 0x0562a9a7,
- 0x05638006,
- 0x056389a7,
- 0x05646006,
- 0x056469a7,
- 0x05654006,
- 0x056549a7,
- 0x05662006,
- 0x056629a7,
- 0x05670006,
- 0x056709a7,
- 0x0567e006,
- 0x0567e9a7,
- 0x0568c006,
- 0x0568c9a7,
- 0x0569a006,
- 0x0569a9a7,
- 0x056a8006,
- 0x056a89a7,
- 0x056b6006,
- 0x056b69a7,
- 0x056c4006,
- 0x056c49a7,
- 0x056d2006,
- 0x056d29a7,
- 0x056e0006,
- 0x056e09a7,
- 0x056ee006,
- 0x056ee9a7,
- 0x056fc006,
- 0x056fc9a7,
- 0x0570a006,
- 0x0570a9a7,
- 0x05718006,
- 0x057189a7,
- 0x05726006,
- 0x057269a7,
- 0x05734006,
- 0x057349a7,
- 0x05742006,
- 0x057429a7,
- 0x05750006,
- 0x057509a7,
- 0x0575e006,
- 0x0575e9a7,
- 0x0576c006,
- 0x0576c9a7,
- 0x0577a006,
- 0x0577a9a7,
- 0x05788006,
- 0x057889a7,
- 0x05796006,
- 0x057969a7,
- 0x057a4006,
- 0x057a49a7,
- 0x057b2006,
- 0x057b29a7,
- 0x057c0006,
- 0x057c09a7,
- 0x057ce006,
- 0x057ce9a7,
- 0x057dc006,
- 0x057dc9a7,
- 0x057ea006,
- 0x057ea9a7,
- 0x057f8006,
- 0x057f89a7,
- 0x05806006,
- 0x058069a7,
- 0x05814006,
- 0x058149a7,
- 0x05822006,
- 0x058229a7,
- 0x05830006,
- 0x058309a7,
- 0x0583e006,
- 0x0583e9a7,
- 0x0584c006,
- 0x0584c9a7,
- 0x0585a006,
- 0x0585a9a7,
- 0x05868006,
- 0x058689a7,
- 0x05876006,
- 0x058769a7,
- 0x05884006,
- 0x058849a7,
- 0x05892006,
- 0x058929a7,
- 0x058a0006,
- 0x058a09a7,
- 0x058ae006,
- 0x058ae9a7,
- 0x058bc006,
- 0x058bc9a7,
- 0x058ca006,
- 0x058ca9a7,
- 0x058d8006,
- 0x058d89a7,
- 0x058e6006,
- 0x058e69a7,
- 0x058f4006,
- 0x058f49a7,
- 0x05902006,
- 0x059029a7,
- 0x05910006,
- 0x059109a7,
- 0x0591e006,
- 0x0591e9a7,
- 0x0592c006,
- 0x0592c9a7,
- 0x0593a006,
- 0x0593a9a7,
- 0x05948006,
- 0x059489a7,
- 0x05956006,
- 0x059569a7,
- 0x05964006,
- 0x059649a7,
- 0x05972006,
- 0x059729a7,
- 0x05980006,
- 0x059809a7,
- 0x0598e006,
- 0x0598e9a7,
- 0x0599c006,
- 0x0599c9a7,
- 0x059aa006,
- 0x059aa9a7,
- 0x059b8006,
- 0x059b89a7,
- 0x059c6006,
- 0x059c69a7,
- 0x059d4006,
- 0x059d49a7,
- 0x059e2006,
- 0x059e29a7,
- 0x059f0006,
- 0x059f09a7,
- 0x059fe006,
- 0x059fe9a7,
- 0x05a0c006,
- 0x05a0c9a7,
- 0x05a1a006,
- 0x05a1a9a7,
- 0x05a28006,
- 0x05a289a7,
- 0x05a36006,
- 0x05a369a7,
- 0x05a44006,
- 0x05a449a7,
- 0x05a52006,
- 0x05a529a7,
- 0x05a60006,
- 0x05a609a7,
- 0x05a6e006,
- 0x05a6e9a7,
- 0x05a7c006,
- 0x05a7c9a7,
- 0x05a8a006,
- 0x05a8a9a7,
- 0x05a98006,
- 0x05a989a7,
- 0x05aa6006,
- 0x05aa69a7,
- 0x05ab4006,
- 0x05ab49a7,
- 0x05ac2006,
- 0x05ac29a7,
- 0x05ad0006,
- 0x05ad09a7,
- 0x05ade006,
- 0x05ade9a7,
- 0x05aec006,
- 0x05aec9a7,
- 0x05afa006,
- 0x05afa9a7,
- 0x05b08006,
- 0x05b089a7,
- 0x05b16006,
- 0x05b169a7,
- 0x05b24006,
- 0x05b249a7,
- 0x05b32006,
- 0x05b329a7,
- 0x05b40006,
- 0x05b409a7,
- 0x05b4e006,
- 0x05b4e9a7,
- 0x05b5c006,
- 0x05b5c9a7,
- 0x05b6a006,
- 0x05b6a9a7,
- 0x05b78006,
- 0x05b789a7,
- 0x05b86006,
- 0x05b869a7,
- 0x05b94006,
- 0x05b949a7,
- 0x05ba2006,
- 0x05ba29a7,
- 0x05bb0006,
- 0x05bb09a7,
- 0x05bbe006,
- 0x05bbe9a7,
- 0x05bcc006,
- 0x05bcc9a7,
- 0x05bda006,
- 0x05bda9a7,
- 0x05be8006,
- 0x05be89a7,
- 0x05bf6006,
- 0x05bf69a7,
- 0x05c04006,
- 0x05c049a7,
- 0x05c12006,
- 0x05c129a7,
- 0x05c20006,
- 0x05c209a7,
- 0x05c2e006,
- 0x05c2e9a7,
- 0x05c3c006,
- 0x05c3c9a7,
- 0x05c4a006,
- 0x05c4a9a7,
- 0x05c58006,
- 0x05c589a7,
- 0x05c66006,
- 0x05c669a7,
- 0x05c74006,
- 0x05c749a7,
- 0x05c82006,
- 0x05c829a7,
- 0x05c90006,
- 0x05c909a7,
- 0x05c9e006,
- 0x05c9e9a7,
- 0x05cac006,
- 0x05cac9a7,
- 0x05cba006,
- 0x05cba9a7,
- 0x05cc8006,
- 0x05cc89a7,
- 0x05cd6006,
- 0x05cd69a7,
- 0x05ce4006,
- 0x05ce49a7,
- 0x05cf2006,
- 0x05cf29a7,
- 0x05d00006,
- 0x05d009a7,
- 0x05d0e006,
- 0x05d0e9a7,
- 0x05d1c006,
- 0x05d1c9a7,
- 0x05d2a006,
- 0x05d2a9a7,
- 0x05d38006,
- 0x05d389a7,
- 0x05d46006,
- 0x05d469a7,
- 0x05d54006,
- 0x05d549a7,
- 0x05d62006,
- 0x05d629a7,
- 0x05d70006,
- 0x05d709a7,
- 0x05d7e006,
- 0x05d7e9a7,
- 0x05d8c006,
- 0x05d8c9a7,
- 0x05d9a006,
- 0x05d9a9a7,
- 0x05da8006,
- 0x05da89a7,
- 0x05db6006,
- 0x05db69a7,
- 0x05dc4006,
- 0x05dc49a7,
- 0x05dd2006,
- 0x05dd29a7,
- 0x05de0006,
- 0x05de09a7,
- 0x05dee006,
- 0x05dee9a7,
- 0x05dfc006,
- 0x05dfc9a7,
- 0x05e0a006,
- 0x05e0a9a7,
- 0x05e18006,
- 0x05e189a7,
- 0x05e26006,
- 0x05e269a7,
- 0x05e34006,
- 0x05e349a7,
- 0x05e42006,
- 0x05e429a7,
- 0x05e50006,
- 0x05e509a7,
- 0x05e5e006,
- 0x05e5e9a7,
- 0x05e6c006,
- 0x05e6c9a7,
- 0x05e7a006,
- 0x05e7a9a7,
- 0x05e88006,
- 0x05e889a7,
- 0x05e96006,
- 0x05e969a7,
- 0x05ea4006,
- 0x05ea49a7,
- 0x05eb2006,
- 0x05eb29a7,
- 0x05ec0006,
- 0x05ec09a7,
- 0x05ece006,
- 0x05ece9a7,
- 0x05edc006,
- 0x05edc9a7,
- 0x05eea006,
- 0x05eea9a7,
- 0x05ef8006,
- 0x05ef89a7,
- 0x05f06006,
- 0x05f069a7,
- 0x05f14006,
- 0x05f149a7,
- 0x05f22006,
- 0x05f229a7,
- 0x05f30006,
- 0x05f309a7,
- 0x05f3e006,
- 0x05f3e9a7,
- 0x05f4c006,
- 0x05f4c9a7,
- 0x05f5a006,
- 0x05f5a9a7,
- 0x05f68006,
- 0x05f689a7,
- 0x05f76006,
- 0x05f769a7,
- 0x05f84006,
- 0x05f849a7,
- 0x05f92006,
- 0x05f929a7,
- 0x05fa0006,
- 0x05fa09a7,
- 0x05fae006,
- 0x05fae9a7,
- 0x05fbc006,
- 0x05fbc9a7,
- 0x05fca006,
- 0x05fca9a7,
- 0x05fd8006,
- 0x05fd89a7,
- 0x05fe6006,
- 0x05fe69a7,
- 0x05ff4006,
- 0x05ff49a7,
- 0x06002006,
- 0x060029a7,
- 0x06010006,
- 0x060109a7,
- 0x0601e006,
- 0x0601e9a7,
- 0x0602c006,
- 0x0602c9a7,
- 0x0603a006,
- 0x0603a9a7,
- 0x06048006,
- 0x060489a7,
- 0x06056006,
- 0x060569a7,
- 0x06064006,
- 0x060649a7,
- 0x06072006,
- 0x060729a7,
- 0x06080006,
- 0x060809a7,
- 0x0608e006,
- 0x0608e9a7,
- 0x0609c006,
- 0x0609c9a7,
- 0x060aa006,
- 0x060aa9a7,
- 0x060b8006,
- 0x060b89a7,
- 0x060c6006,
- 0x060c69a7,
- 0x060d4006,
- 0x060d49a7,
- 0x060e2006,
- 0x060e29a7,
- 0x060f0006,
- 0x060f09a7,
- 0x060fe006,
- 0x060fe9a7,
- 0x0610c006,
- 0x0610c9a7,
- 0x0611a006,
- 0x0611a9a7,
- 0x06128006,
- 0x061289a7,
- 0x06136006,
- 0x061369a7,
- 0x06144006,
- 0x061449a7,
- 0x06152006,
- 0x061529a7,
- 0x06160006,
- 0x061609a7,
- 0x0616e006,
- 0x0616e9a7,
- 0x0617c006,
- 0x0617c9a7,
- 0x0618a006,
- 0x0618a9a7,
- 0x06198006,
- 0x061989a7,
- 0x061a6006,
- 0x061a69a7,
- 0x061b4006,
- 0x061b49a7,
- 0x061c2006,
- 0x061c29a7,
- 0x061d0006,
- 0x061d09a7,
- 0x061de006,
- 0x061de9a7,
- 0x061ec006,
- 0x061ec9a7,
- 0x061fa006,
- 0x061fa9a7,
- 0x06208006,
- 0x062089a7,
- 0x06216006,
- 0x062169a7,
- 0x06224006,
- 0x062249a7,
- 0x06232006,
- 0x062329a7,
- 0x06240006,
- 0x062409a7,
- 0x0624e006,
- 0x0624e9a7,
- 0x0625c006,
- 0x0625c9a7,
- 0x0626a006,
- 0x0626a9a7,
- 0x06278006,
- 0x062789a7,
- 0x06286006,
- 0x062869a7,
- 0x06294006,
- 0x062949a7,
- 0x062a2006,
- 0x062a29a7,
- 0x062b0006,
- 0x062b09a7,
- 0x062be006,
- 0x062be9a7,
- 0x062cc006,
- 0x062cc9a7,
- 0x062da006,
- 0x062da9a7,
- 0x062e8006,
- 0x062e89a7,
- 0x062f6006,
- 0x062f69a7,
- 0x06304006,
- 0x063049a7,
- 0x06312006,
- 0x063129a7,
- 0x06320006,
- 0x063209a7,
- 0x0632e006,
- 0x0632e9a7,
- 0x0633c006,
- 0x0633c9a7,
- 0x0634a006,
- 0x0634a9a7,
- 0x06358006,
- 0x063589a7,
- 0x06366006,
- 0x063669a7,
- 0x06374006,
- 0x063749a7,
- 0x06382006,
- 0x063829a7,
- 0x06390006,
- 0x063909a7,
- 0x0639e006,
- 0x0639e9a7,
- 0x063ac006,
- 0x063ac9a7,
- 0x063ba006,
- 0x063ba9a7,
- 0x063c8006,
- 0x063c89a7,
- 0x063d6006,
- 0x063d69a7,
- 0x063e4006,
- 0x063e49a7,
- 0x063f2006,
- 0x063f29a7,
- 0x06400006,
- 0x064009a7,
- 0x0640e006,
- 0x0640e9a7,
- 0x0641c006,
- 0x0641c9a7,
- 0x0642a006,
- 0x0642a9a7,
- 0x06438006,
- 0x064389a7,
- 0x06446006,
- 0x064469a7,
- 0x06454006,
- 0x064549a7,
- 0x06462006,
- 0x064629a7,
- 0x06470006,
- 0x064709a7,
- 0x0647e006,
- 0x0647e9a7,
- 0x0648c006,
- 0x0648c9a7,
- 0x0649a006,
- 0x0649a9a7,
- 0x064a8006,
- 0x064a89a7,
- 0x064b6006,
- 0x064b69a7,
- 0x064c4006,
- 0x064c49a7,
- 0x064d2006,
- 0x064d29a7,
- 0x064e0006,
- 0x064e09a7,
- 0x064ee006,
- 0x064ee9a7,
- 0x064fc006,
- 0x064fc9a7,
- 0x0650a006,
- 0x0650a9a7,
- 0x06518006,
- 0x065189a7,
- 0x06526006,
- 0x065269a7,
- 0x06534006,
- 0x065349a7,
- 0x06542006,
- 0x065429a7,
- 0x06550006,
- 0x065509a7,
- 0x0655e006,
- 0x0655e9a7,
- 0x0656c006,
- 0x0656c9a7,
- 0x0657a006,
- 0x0657a9a7,
- 0x06588006,
- 0x065889a7,
- 0x06596006,
- 0x065969a7,
- 0x065a4006,
- 0x065a49a7,
- 0x065b2006,
- 0x065b29a7,
- 0x065c0006,
- 0x065c09a7,
- 0x065ce006,
- 0x065ce9a7,
- 0x065dc006,
- 0x065dc9a7,
- 0x065ea006,
- 0x065ea9a7,
- 0x065f8006,
- 0x065f89a7,
- 0x06606006,
- 0x066069a7,
- 0x06614006,
- 0x066149a7,
- 0x06622006,
- 0x066229a7,
- 0x06630006,
- 0x066309a7,
- 0x0663e006,
- 0x0663e9a7,
- 0x0664c006,
- 0x0664c9a7,
- 0x0665a006,
- 0x0665a9a7,
- 0x06668006,
- 0x066689a7,
- 0x06676006,
- 0x066769a7,
- 0x06684006,
- 0x066849a7,
- 0x06692006,
- 0x066929a7,
- 0x066a0006,
- 0x066a09a7,
- 0x066ae006,
- 0x066ae9a7,
- 0x066bc006,
- 0x066bc9a7,
- 0x066ca006,
- 0x066ca9a7,
- 0x066d8006,
- 0x066d89a7,
- 0x066e6006,
- 0x066e69a7,
- 0x066f4006,
- 0x066f49a7,
- 0x06702006,
- 0x067029a7,
- 0x06710006,
- 0x067109a7,
- 0x0671e006,
- 0x0671e9a7,
- 0x0672c006,
- 0x0672c9a7,
- 0x0673a006,
- 0x0673a9a7,
- 0x06748006,
- 0x067489a7,
- 0x06756006,
- 0x067569a7,
- 0x06764006,
- 0x067649a7,
- 0x06772006,
- 0x067729a7,
- 0x06780006,
- 0x067809a7,
- 0x0678e006,
- 0x0678e9a7,
- 0x0679c006,
- 0x0679c9a7,
- 0x067aa006,
- 0x067aa9a7,
- 0x067b8006,
- 0x067b89a7,
- 0x067c6006,
- 0x067c69a7,
- 0x067d4006,
- 0x067d49a7,
- 0x067e2006,
- 0x067e29a7,
- 0x067f0006,
- 0x067f09a7,
- 0x067fe006,
- 0x067fe9a7,
- 0x0680c006,
- 0x0680c9a7,
- 0x0681a006,
- 0x0681a9a7,
- 0x06828006,
- 0x068289a7,
- 0x06836006,
- 0x068369a7,
- 0x06844006,
- 0x068449a7,
- 0x06852006,
- 0x068529a7,
- 0x06860006,
- 0x068609a7,
- 0x0686e006,
- 0x0686e9a7,
- 0x0687c006,
- 0x0687c9a7,
- 0x0688a006,
- 0x0688a9a7,
- 0x06898006,
- 0x068989a7,
- 0x068a6006,
- 0x068a69a7,
- 0x068b4006,
- 0x068b49a7,
- 0x068c2006,
- 0x068c29a7,
- 0x068d0006,
- 0x068d09a7,
- 0x068de006,
- 0x068de9a7,
- 0x068ec006,
- 0x068ec9a7,
- 0x068fa006,
- 0x068fa9a7,
- 0x06908006,
- 0x069089a7,
- 0x06916006,
- 0x069169a7,
- 0x06924006,
- 0x069249a7,
- 0x06932006,
- 0x069329a7,
- 0x06940006,
- 0x069409a7,
- 0x0694e006,
- 0x0694e9a7,
- 0x0695c006,
- 0x0695c9a7,
- 0x0696a006,
- 0x0696a9a7,
- 0x06978006,
- 0x069789a7,
- 0x06986006,
- 0x069869a7,
- 0x06994006,
- 0x069949a7,
- 0x069a2006,
- 0x069a29a7,
- 0x069b0006,
- 0x069b09a7,
- 0x069be006,
- 0x069be9a7,
- 0x069cc006,
- 0x069cc9a7,
- 0x069da006,
- 0x069da9a7,
- 0x069e8006,
- 0x069e89a7,
- 0x069f6006,
- 0x069f69a7,
- 0x06a04006,
- 0x06a049a7,
- 0x06a12006,
- 0x06a129a7,
- 0x06a20006,
- 0x06a209a7,
- 0x06a2e006,
- 0x06a2e9a7,
- 0x06a3c006,
- 0x06a3c9a7,
- 0x06a4a006,
- 0x06a4a9a7,
- 0x06a58006,
- 0x06a589a7,
- 0x06a66006,
- 0x06a669a7,
- 0x06a74006,
- 0x06a749a7,
- 0x06a82006,
- 0x06a829a7,
- 0x06a90006,
- 0x06a909a7,
- 0x06a9e006,
- 0x06a9e9a7,
- 0x06aac006,
- 0x06aac9a7,
- 0x06aba006,
- 0x06aba9a7,
- 0x06ac8006,
- 0x06ac89a7,
- 0x06ad6006,
- 0x06ad69a7,
- 0x06ae4006,
- 0x06ae49a7,
- 0x06af2006,
- 0x06af29a7,
- 0x06b00006,
- 0x06b009a7,
- 0x06b0e006,
- 0x06b0e9a7,
- 0x06b1c006,
- 0x06b1c9a7,
- 0x06b2a006,
- 0x06b2a9a7,
- 0x06b38006,
- 0x06b389a7,
- 0x06b46006,
- 0x06b469a7,
- 0x06b54006,
- 0x06b549a7,
- 0x06b62006,
- 0x06b629a7,
- 0x06b70006,
- 0x06b709a7,
- 0x06b7e006,
- 0x06b7e9a7,
- 0x06b8c006,
- 0x06b8c9a7,
- 0x06b9a006,
- 0x06b9a9a7,
- 0x06ba8006,
- 0x06ba89a7,
- 0x06bb6006,
- 0x06bb69a7,
- 0x06bc4006,
- 0x06bc49a7,
- 0x06bd816c,
- 0x06be5b0b,
- 0x07d8f002,
- 0x07f000f2,
- 0x07f100f2,
- 0x07f7f801,
- 0x07fcf012,
- 0x07ff80b1,
- 0x080fe802,
- 0x08170002,
- 0x081bb042,
- 0x08500822,
- 0x08502812,
- 0x08506032,
- 0x0851c022,
- 0x0851f802,
- 0x08572812,
- 0x08692032,
- 0x08755812,
- 0x0877e822,
- 0x087a30a2,
- 0x087c1032,
- 0x0880000a,
- 0x08800802,
- 0x0880100a,
- 0x0881c0e2,
- 0x08838002,
- 0x08839812,
- 0x0883f822,
- 0x0884100a,
- 0x0885802a,
- 0x08859832,
- 0x0885b81a,
- 0x0885c812,
- 0x0885e808,
- 0x08861002,
- 0x08866808,
- 0x08880022,
- 0x08893842,
- 0x0889600a,
- 0x08896872,
- 0x088a281a,
- 0x088b9802,
- 0x088c0012,
- 0x088c100a,
- 0x088d982a,
- 0x088db082,
- 0x088df81a,
- 0x088e1018,
- 0x088e4832,
- 0x088e700a,
- 0x088e7802,
- 0x0891602a,
- 0x08917822,
- 0x0891901a,
- 0x0891a002,
- 0x0891a80a,
- 0x0891b012,
- 0x0891f002,
- 0x08920802,
- 0x0896f802,
- 0x0897002a,
- 0x08971872,
- 0x08980012,
- 0x0898101a,
- 0x0899d812,
- 0x0899f002,
- 0x0899f80a,
- 0x089a0002,
- 0x089a083a,
- 0x089a381a,
- 0x089a582a,
- 0x089ab802,
- 0x089b101a,
- 0x089b3062,
- 0x089b8042,
- 0x08a1a82a,
- 0x08a1c072,
- 0x08a2001a,
- 0x08a21022,
- 0x08a2280a,
- 0x08a23002,
- 0x08a2f002,
- 0x08a58002,
- 0x08a5881a,
- 0x08a59852,
- 0x08a5c80a,
- 0x08a5d002,
- 0x08a5d81a,
- 0x08a5e802,
- 0x08a5f00a,
- 0x08a5f812,
- 0x08a6080a,
- 0x08a61012,
- 0x08ad7802,
- 0x08ad801a,
- 0x08ad9032,
- 0x08adc03a,
- 0x08ade012,
- 0x08adf00a,
- 0x08adf812,
- 0x08aee012,
- 0x08b1802a,
- 0x08b19872,
- 0x08b1d81a,
- 0x08b1e802,
- 0x08b1f00a,
- 0x08b1f812,
- 0x08b55802,
- 0x08b5600a,
- 0x08b56802,
- 0x08b5701a,
- 0x08b58052,
- 0x08b5b00a,
- 0x08b5b802,
- 0x08b8e822,
- 0x08b91032,
- 0x08b9300a,
- 0x08b93842,
- 0x08c1602a,
- 0x08c17882,
- 0x08c1c00a,
- 0x08c1c812,
- 0x08c98002,
- 0x08c9884a,
- 0x08c9b81a,
- 0x08c9d812,
- 0x08c9e80a,
- 0x08c9f002,
- 0x08c9f808,
- 0x08ca000a,
- 0x08ca0808,
- 0x08ca100a,
- 0x08ca1802,
- 0x08ce882a,
- 0x08cea032,
- 0x08ced012,
- 0x08cee03a,
- 0x08cf0002,
- 0x08cf200a,
- 0x08d00892,
- 0x08d19852,
- 0x08d1c80a,
- 0x08d1d008,
- 0x08d1d832,
- 0x08d23802,
- 0x08d28852,
- 0x08d2b81a,
- 0x08d2c822,
- 0x08d42058,
- 0x08d450c2,
- 0x08d4b80a,
- 0x08d4c012,
- 0x08e1780a,
- 0x08e18062,
- 0x08e1c052,
- 0x08e1f00a,
- 0x08e1f802,
- 0x08e49152,
- 0x08e5480a,
- 0x08e55062,
- 0x08e5880a,
- 0x08e59012,
- 0x08e5a00a,
- 0x08e5a812,
- 0x08e98852,
- 0x08e9d002,
- 0x08e9e012,
- 0x08e9f862,
- 0x08ea3008,
- 0x08ea3802,
- 0x08ec504a,
- 0x08ec8012,
- 0x08ec981a,
- 0x08eca802,
- 0x08ecb00a,
- 0x08ecb802,
- 0x08f79812,
- 0x08f7a81a,
- 0x08f80012,
- 0x08f81008,
- 0x08f8180a,
- 0x08f9a01a,
- 0x08f9b042,
- 0x08f9f01a,
- 0x08fa0002,
- 0x08fa080a,
- 0x08fa1002,
- 0x09a180f1,
- 0x09a20002,
- 0x09a238e2,
- 0x0b578042,
- 0x0b598062,
- 0x0b7a7802,
- 0x0b7a8b6a,
- 0x0b7c7832,
- 0x0b7f2002,
- 0x0b7f801a,
- 0x0de4e812,
- 0x0de50031,
- 0x0e7802d2,
- 0x0e798162,
- 0x0e8b2802,
- 0x0e8b300a,
- 0x0e8b3822,
- 0x0e8b680a,
- 0x0e8b7042,
- 0x0e8b9871,
- 0x0e8bd872,
- 0x0e8c2862,
- 0x0e8d5032,
- 0x0e921022,
- 0x0ed00362,
- 0x0ed1db12,
- 0x0ed3a802,
- 0x0ed42002,
- 0x0ed4d842,
- 0x0ed508e2,
- 0x0f000062,
- 0x0f004102,
- 0x0f00d862,
- 0x0f011812,
- 0x0f013042,
- 0x0f047802,
- 0x0f098062,
- 0x0f157002,
- 0x0f176032,
- 0x0f276032,
- 0x0f468062,
- 0x0f4a2062,
- 0x0f8007f3,
- 0x0f8407f3,
- 0x0f886823,
- 0x0f897803,
- 0x0f8b6053,
- 0x0f8bf013,
- 0x0f8c7003,
- 0x0f8c8893,
- 0x0f8d6b83,
- 0x0f8f3199,
- 0x0f9008e3,
- 0x0f90d003,
- 0x0f917803,
- 0x0f919083,
- 0x0f91e033,
- 0x0f924ff3,
- 0x0f964ff3,
- 0x0f9a4ff3,
- 0x0f9e4b13,
- 0x0f9fd842,
- 0x0fa007f3,
- 0x0fa407f3,
- 0x0fa803d3,
- 0x0faa37f3,
- 0x0fae37f3,
- 0x0fb23093,
- 0x0fb407f3,
- 0x0fbba0b3,
- 0x0fbeaaa3,
- 0x0fc06033,
- 0x0fc24073,
- 0x0fc2d053,
- 0x0fc44073,
- 0x0fc57513,
- 0x0fc862e3,
- 0x0fc9e093,
- 0x0fca3ff3,
- 0x0fce3ff3,
- 0x0fd23ff3,
- 0x0fd63b83,
- 0x0fe007f3,
- 0x0fe407f3,
- 0x0fe807f3,
- 0x0fec07f3,
- 0x0ff007f3,
- 0x0ff407f3,
- 0x0ff807f3,
- 0x0ffc07d3,
- 0x700001f1,
- 0x700105f2,
- 0x700407f1,
- 0x700807f2,
- 0x700c06f2,
- 0x700f87f1,
- 0x701387f1,
- 0x701787f1,
- 0x701b87f1,
- 0x701f87f1,
- 0x702387f1,
- 0x702787f1,
- 0x702b87f1,
- 0x702f87f1,
- 0x703387f1,
- 0x703787f1,
- 0x703b87f1,
- 0x703f87f1,
- 0x704387f1,
- 0x704787f1,
- 0x704b87f1,
- 0x704f87f1,
- 0x705387f1,
- 0x705787f1,
- 0x705b87f1,
- 0x705f87f1,
- 0x706387f1,
- 0x706787f1,
- 0x706b87f1,
- 0x706f87f1,
- 0x707387f1,
- 0x707787f1,
- 0x707b87f1,
- 0x707f80f1};
-// clang-format on
-
-/// Returns the extended grapheme cluster bondary property of a code point.
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept {
- // The algorithm searches for the upper bound of the range and, when found,
- // steps back one entry. This algorithm is used since the code point can be
- // anywhere in the range. After a lower bound is found the next step is to
- // compare whether the code unit is indeed in the range.
- //
- // Since the entry contains a code unit, size, and property the code point
- // being sought needs to be adjusted. Just shifting the code point to the
- // proper position doesn't work; suppose an entry has property 0, size 1,
- // and lower bound 3. This results in the entry 0x1810.
- // When searching for code point 3 it will search for 0x1800, find 0x1810
- // and moves to the previous entry. Thus the lower bound value will never
- // be found.
- // The simple solution is to set the bits belonging to the property and
- // size. Then the upper bound for code point 3 will return the entry after
- // 0x1810. After moving to the previous entry the algorithm arrives at the
- // correct entry.
- ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
- if (__i == 0)
- return __property::__none;
-
- --__i;
- uint32_t __upper_bound = (__entries[__i] >> 11) + ((__entries[__i] >> 4) & 0x7f);
- if (__code_point <= __upper_bound)
- return static_cast<__property>(__entries[__i] & 0xf);
-
- return __property::__none;
-}
-
-} // namespace __extended_grapheme_custer_property_boundary
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
diff --git a/libcxx/include/__cxx03/__format/format_arg.h b/libcxx/include/__cxx03/__format/format_arg.h
deleted file mode 100644
index cf9bf75e60df9..0000000000000
--- a/libcxx/include/__cxx03/__format/format_arg.h
+++ /dev/null
@@ -1,401 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_ARG_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_ARG_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__fwd/format.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/__variant/monostate.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format {
-/// The type stored in @ref basic_format_arg.
-///
-/// @note The 128-bit types are unconditionally in the list to avoid the values
-/// of the enums to depend on the availability of 128-bit integers.
-///
-/// @note The value is stored as a 5-bit value in the __packed_arg_t_bits. This
-/// limits the maximum number of elements to 32.
-/// When modifying update the test
-/// test/libcxx/utilities/format/format.arguments/format.arg/arg_t.compile.pass.cpp
-/// It could be packed in 4-bits but that means a new type directly becomes an
-/// ABI break. The packed type is 64-bit so this reduces the maximum number of
-/// packed elements from 16 to 12.
-///
-/// @note Some members of this enum are an extension. These extensions need
-/// special behaviour in visit_format_arg. There they need to be wrapped in a
-/// handle to satisfy the user observable behaviour. The internal function
-/// __visit_format_arg doesn't do this wrapping. So in the format functions
-/// this function is used to avoid unneeded overhead.
-enum class __arg_t : uint8_t {
- __none,
- __boolean,
- __char_type,
- __int,
- __long_long,
- __i128, // extension
- __unsigned,
- __unsigned_long_long,
- __u128, // extension
- __float,
- __double,
- __long_double,
- __const_char_type_ptr,
- __string_view,
- __ptr,
- __handle
-};
-
-inline constexpr unsigned __packed_arg_t_bits = 5;
-inline constexpr uint8_t __packed_arg_t_mask = 0x1f;
-
-inline constexpr unsigned __packed_types_storage_bits = 64;
-inline constexpr unsigned __packed_types_max = __packed_types_storage_bits / __packed_arg_t_bits;
-
-_LIBCPP_HIDE_FROM_ABI constexpr bool __use_packed_format_arg_store(size_t __size) {
- return __size <= __packed_types_max;
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) {
- _LIBCPP_ASSERT_INTERNAL(__id <= __packed_types_max, "");
-
- if (__id > 0)
- __types >>= __id * __packed_arg_t_bits;
-
- return static_cast<__format::__arg_t>(__types & __packed_arg_t_mask);
-}
-
-} // namespace __format
-
-// This function is not user observable, so it can directly use the non-standard
-// types of the "variant". See __arg_t for more details.
-template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
- switch (__arg.__type_) {
- case __format::__arg_t::__none:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_);
- case __format::__arg_t::__boolean:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__boolean_);
- case __format::__arg_t::__char_type:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__char_type_);
- case __format::__arg_t::__int:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__int_);
- case __format::__arg_t::__long_long:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__long_long_);
- case __format::__arg_t::__i128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
-# else
- __libcpp_unreachable();
-# endif
- case __format::__arg_t::__unsigned:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_);
- case __format::__arg_t::__unsigned_long_long:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_long_long_);
- case __format::__arg_t::__u128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
-# else
- __libcpp_unreachable();
-# endif
- case __format::__arg_t::__float:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__float_);
- case __format::__arg_t::__double:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__double_);
- case __format::__arg_t::__long_double:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__long_double_);
- case __format::__arg_t::__const_char_type_ptr:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__const_char_type_ptr_);
- case __format::__arg_t::__string_view:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__string_view_);
- case __format::__arg_t::__ptr:
- return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__ptr_);
- case __format::__arg_t::__handle:
- return std::invoke(
- std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
- }
-
- __libcpp_unreachable();
-}
-
-# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
-
-template <class _Rp, class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
- switch (__arg.__type_) {
- case __format::__arg_t::__none:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_);
- case __format::__arg_t::__boolean:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__boolean_);
- case __format::__arg_t::__char_type:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__char_type_);
- case __format::__arg_t::__int:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__int_);
- case __format::__arg_t::__long_long:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__long_long_);
- case __format::__arg_t::__i128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
-# else
- __libcpp_unreachable();
-# endif
- case __format::__arg_t::__unsigned:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_);
- case __format::__arg_t::__unsigned_long_long:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_long_long_);
- case __format::__arg_t::__u128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
-# else
- __libcpp_unreachable();
-# endif
- case __format::__arg_t::__float:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__float_);
- case __format::__arg_t::__double:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__double_);
- case __format::__arg_t::__long_double:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__long_double_);
- case __format::__arg_t::__const_char_type_ptr:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__const_char_type_ptr_);
- case __format::__arg_t::__string_view:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__string_view_);
- case __format::__arg_t::__ptr:
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__ptr_);
- case __format::__arg_t::__handle:
- return std::invoke_r<_Rp>(
- std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__arg.__value_.__handle_});
- }
-
- __libcpp_unreachable();
-}
-
-# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
-
-/// Contains the values used in basic_format_arg.
-///
-/// This is a separate type so it's possible to store the values and types in
-/// separate arrays.
-template <class _Context>
-class __basic_format_arg_value {
- using _CharT = typename _Context::char_type;
-
-public:
- /// Contains the implementation for basic_format_arg::handle.
- struct __handle {
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI explicit __handle(_Tp& __v) noexcept
- : __ptr_(std::addressof(__v)),
- __format_([](basic_format_parse_context<_CharT>& __parse_ctx, _Context& __ctx, const void* __ptr) {
- using _Dp = remove_const_t<_Tp>;
- using _Qp = conditional_t<__formattable_with<const _Dp, _Context>, const _Dp, _Dp>;
- static_assert(__formattable_with<_Qp, _Context>, "Mandated by [format.arg]/10");
-
- typename _Context::template formatter_type<_Dp> __f;
- __parse_ctx.advance_to(__f.parse(__parse_ctx));
- __ctx.advance_to(__f.format(*const_cast<_Qp*>(static_cast<const _Dp*>(__ptr)), __ctx));
- }) {}
-
- const void* __ptr_;
- void (*__format_)(basic_format_parse_context<_CharT>&, _Context&, const void*);
- };
-
- union {
- monostate __monostate_;
- bool __boolean_;
- _CharT __char_type_;
- int __int_;
- unsigned __unsigned_;
- long long __long_long_;
- unsigned long long __unsigned_long_long_;
-# ifndef _LIBCPP_HAS_NO_INT128
- __int128_t __i128_;
- __uint128_t __u128_;
-# endif
- float __float_;
- double __double_;
- long double __long_double_;
- const _CharT* __const_char_type_ptr_;
- basic_string_view<_CharT> __string_view_;
- const void* __ptr_;
- __handle __handle_;
- };
-
- // These constructors contain the exact storage type used. If adjustments are
- // required, these will be done in __create_format_arg.
-
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value() noexcept : __monostate_() {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(_CharT __value) noexcept : __char_type_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(int __value) noexcept : __int_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(unsigned __value) noexcept : __unsigned_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(long long __value) noexcept : __long_long_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(unsigned long long __value) noexcept
- : __unsigned_long_long_(__value) {}
-# ifndef _LIBCPP_HAS_NO_INT128
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__int128_t __value) noexcept : __i128_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__uint128_t __value) noexcept : __u128_(__value) {}
-# endif
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(float __value) noexcept : __float_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(double __value) noexcept : __double_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(long double __value) noexcept : __long_double_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(const _CharT* __value) noexcept : __const_char_type_ptr_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(basic_string_view<_CharT> __value) noexcept
- : __string_view_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(const void* __value) noexcept : __ptr_(__value) {}
- _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__handle&& __value) noexcept : __handle_(std::move(__value)) {}
-};
-
-template <class _Context>
-class _LIBCPP_TEMPLATE_VIS basic_format_arg {
-public:
- class _LIBCPP_TEMPLATE_VIS handle;
-
- _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept : __type_{__format::__arg_t::__none} {}
-
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
-
-# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
-
- // This function is user facing, so it must wrap the non-standard types of
- // the "variant" in a handle to stay conforming. See __arg_t for more details.
- template <class _Visitor>
- _LIBCPP_HIDE_FROM_ABI decltype(auto) visit(this basic_format_arg __arg, _Visitor&& __vis) {
- switch (__arg.__type_) {
-# ifndef _LIBCPP_HAS_NO_INT128
- case __format::__arg_t::__i128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
- return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-
- case __format::__arg_t::__u128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
- return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-# endif
- default:
- return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
- }
- }
-
- // This function is user facing, so it must wrap the non-standard types of
- // the "variant" in a handle to stay conforming. See __arg_t for more details.
- template <class _Rp, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI _Rp visit(this basic_format_arg __arg, _Visitor&& __vis) {
- switch (__arg.__type_) {
-# ifndef _LIBCPP_HAS_NO_INT128
- case __format::__arg_t::__i128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-
- case __format::__arg_t::__u128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
- return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-# endif
- default:
- return std::__visit_format_arg<_Rp>(std::forward<_Visitor>(__vis), __arg);
- }
- }
-
-# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
-
-private:
- using char_type = typename _Context::char_type;
-
- // TODO FMT Implement constrain [format.arg]/4
- // Constraints: The template specialization
- // typename Context::template formatter_type<T>
- // meets the Formatter requirements ([formatter.requirements]). The extent
- // to which an implementation determines that the specialization meets the
- // Formatter requirements is unspecified, except that as a minimum the
- // expression
- // typename Context::template formatter_type<T>()
- // .format(declval<const T&>(), declval<Context&>())
- // shall be well-formed when treated as an unevaluated operand.
-
-public:
- __basic_format_arg_value<_Context> __value_;
- __format::__arg_t __type_;
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(__format::__arg_t __type,
- __basic_format_arg_value<_Context> __value) noexcept
- : __value_(__value), __type_(__type) {}
-};
-
-template <class _Context>
-class _LIBCPP_TEMPLATE_VIS basic_format_arg<_Context>::handle {
-public:
- _LIBCPP_HIDE_FROM_ABI void format(basic_format_parse_context<char_type>& __parse_ctx, _Context& __ctx) const {
- __handle_.__format_(__parse_ctx, __ctx, __handle_.__ptr_);
- }
-
- _LIBCPP_HIDE_FROM_ABI explicit handle(typename __basic_format_arg_value<_Context>::__handle& __handle) noexcept
- : __handle_(__handle) {}
-
-private:
- typename __basic_format_arg_value<_Context>::__handle& __handle_;
-};
-
-// This function is user facing, so it must wrap the non-standard types of
-// the "variant" in a handle to stay conforming. See __arg_t for more details.
-template <class _Visitor, class _Context>
-# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
-_LIBCPP_DEPRECATED_IN_CXX26
-# endif
- _LIBCPP_HIDE_FROM_ABI decltype(auto)
- visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
- switch (__arg.__type_) {
-# ifndef _LIBCPP_HAS_NO_INT128
- case __format::__arg_t::__i128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
- return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-
- case __format::__arg_t::__u128: {
- typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
- return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
- }
-# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
- default:
- return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
- }
-}
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_ARG_H
diff --git a/libcxx/include/__cxx03/__format/format_arg_store.h b/libcxx/include/__cxx03/__format/format_arg_store.h
deleted file mode 100644
index 1116b53edc20c..0000000000000
--- a/libcxx/include/__cxx03/__format/format_arg_store.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_ARG_STORE_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_ARG_STORE_H
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_arg.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/extent.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format {
-
-/// \returns The @c __arg_t based on the type of the formatting argument.
-///
-/// \pre \c __formattable<_Tp, typename _Context::char_type>
-template <class _Context, class _Tp>
-consteval __arg_t __determine_arg_t();
-
-// Boolean
-template <class, same_as<bool> _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__boolean;
-}
-
-// Char
-template <class _Context, same_as<typename _Context::char_type> _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__char_type;
-}
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class _Context, class _CharT>
- requires(same_as<typename _Context::char_type, wchar_t> && same_as<_CharT, char>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__char_type;
-}
-# endif
-
-// Signed integers
-template <class, __libcpp_signed_integer _Tp>
-consteval __arg_t __determine_arg_t() {
- if constexpr (sizeof(_Tp) <= sizeof(int))
- return __arg_t::__int;
- else if constexpr (sizeof(_Tp) <= sizeof(long long))
- return __arg_t::__long_long;
-# ifndef _LIBCPP_HAS_NO_INT128
- else if constexpr (sizeof(_Tp) == sizeof(__int128_t))
- return __arg_t::__i128;
-# endif
- else
- static_assert(sizeof(_Tp) == 0, "an unsupported signed integer was used");
-}
-
-// Unsigned integers
-template <class, __libcpp_unsigned_integer _Tp>
-consteval __arg_t __determine_arg_t() {
- if constexpr (sizeof(_Tp) <= sizeof(unsigned))
- return __arg_t::__unsigned;
- else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long))
- return __arg_t::__unsigned_long_long;
-# ifndef _LIBCPP_HAS_NO_INT128
- else if constexpr (sizeof(_Tp) == sizeof(__uint128_t))
- return __arg_t::__u128;
-# endif
- else
- static_assert(sizeof(_Tp) == 0, "an unsupported unsigned integer was used");
-}
-
-// Floating-point
-template <class, same_as<float> _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__float;
-}
-template <class, same_as<double> _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__double;
-}
-template <class, same_as<long double> _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__long_double;
-}
-
-// Char pointer
-template <class _Context, class _Tp>
- requires(same_as<typename _Context::char_type*, _Tp> || same_as<const typename _Context::char_type*, _Tp>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__const_char_type_ptr;
-}
-
-// Char array
-template <class _Context, class _Tp>
- requires(is_array_v<_Tp> && same_as<_Tp, typename _Context::char_type[extent_v<_Tp>]>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__string_view;
-}
-
-// String view
-template <class _Context, class _Tp>
- requires(same_as<typename _Context::char_type, typename _Tp::value_type> &&
- same_as<_Tp, basic_string_view<typename _Tp::value_type, typename _Tp::traits_type>>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__string_view;
-}
-
-// String
-template <class _Context, class _Tp>
- requires(
- same_as<typename _Context::char_type, typename _Tp::value_type> &&
- same_as<_Tp, basic_string<typename _Tp::value_type, typename _Tp::traits_type, typename _Tp::allocator_type>>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__string_view;
-}
-
-// Pointers
-template <class, class _Ptr>
- requires(same_as<_Ptr, void*> || same_as<_Ptr, const void*> || same_as<_Ptr, nullptr_t>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__ptr;
-}
-
-// Handle
-//
-// Note this version can't be constrained avoiding ambiguous overloads.
-// That means it can be instantiated by disabled formatters. To solve this, a
-// constrained version for not formattable formatters is added.
-template <class _Context, class _Tp>
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__handle;
-}
-
-// The overload for not formattable types allows triggering the static
-// assertion below.
-template <class _Context, class _Tp>
- requires(!__formattable_with<_Tp, _Context>)
-consteval __arg_t __determine_arg_t() {
- return __arg_t::__none;
-}
-
-// Pseudo constuctor for basic_format_arg
-//
-// Modeled after template<class T> explicit basic_format_arg(T& v) noexcept;
-// [format.arg]/4-6
-template <class _Context, class _Tp>
-_LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __value) noexcept {
- using _Dp = remove_const_t<_Tp>;
- constexpr __arg_t __arg = __determine_arg_t<_Context, _Dp>();
- static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
- static_assert(__formattable_with<_Tp, _Context>);
-
- // Not all types can be used to directly initialize the
- // __basic_format_arg_value. First handle all types needing adjustment, the
- // final else requires no adjustment.
- if constexpr (__arg == __arg_t::__char_type)
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- if constexpr (same_as<typename _Context::char_type, wchar_t> && same_as<_Dp, char>)
- return basic_format_arg<_Context>{__arg, static_cast<wchar_t>(static_cast<unsigned char>(__value))};
- else
-# endif
- return basic_format_arg<_Context>{__arg, __value};
- else if constexpr (__arg == __arg_t::__int)
- return basic_format_arg<_Context>{__arg, static_cast<int>(__value)};
- else if constexpr (__arg == __arg_t::__long_long)
- return basic_format_arg<_Context>{__arg, static_cast<long long>(__value)};
- else if constexpr (__arg == __arg_t::__unsigned)
- return basic_format_arg<_Context>{__arg, static_cast<unsigned>(__value)};
- else if constexpr (__arg == __arg_t::__unsigned_long_long)
- return basic_format_arg<_Context>{__arg, static_cast<unsigned long long>(__value)};
- else if constexpr (__arg == __arg_t::__string_view)
- // Using std::size on a character array will add the NUL-terminator to the size.
- if constexpr (is_array_v<_Dp>)
- return basic_format_arg<_Context>{
- __arg, basic_string_view<typename _Context::char_type>{__value, extent_v<_Dp> - 1}};
- else
- // When the _Traits or _Allocator are different an implicit conversion will
- // fail.
- return basic_format_arg<_Context>{
- __arg, basic_string_view<typename _Context::char_type>{__value.data(), __value.size()}};
- else if constexpr (__arg == __arg_t::__ptr)
- return basic_format_arg<_Context>{__arg, static_cast<const void*>(__value)};
- else if constexpr (__arg == __arg_t::__handle)
- return basic_format_arg<_Context>{__arg, typename __basic_format_arg_value<_Context>::__handle{__value}};
- else
- return basic_format_arg<_Context>{__arg, __value};
-}
-
-template <class _Context, class... _Args>
-_LIBCPP_HIDE_FROM_ABI void
-__create_packed_storage(uint64_t& __types, __basic_format_arg_value<_Context>* __values, _Args&... __args) noexcept {
- int __shift = 0;
- (
- [&] {
- basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
- if (__shift != 0)
- __types |= static_cast<uint64_t>(__arg.__type_) << __shift;
- else
- // Assigns the initial value.
- __types = static_cast<uint64_t>(__arg.__type_);
- __shift += __packed_arg_t_bits;
- *__values++ = __arg.__value_;
- }(),
- ...);
-}
-
-template <class _Context, class... _Args>
-_LIBCPP_HIDE_FROM_ABI void __store_basic_format_arg(basic_format_arg<_Context>* __data, _Args&... __args) noexcept {
- ([&] { *__data++ = __format::__create_format_arg<_Context>(__args); }(), ...);
-}
-
-template <class _Context, size_t _Np>
-struct __packed_format_arg_store {
- __basic_format_arg_value<_Context> __values_[_Np];
- uint64_t __types_ = 0;
-};
-
-template <class _Context, size_t _Np>
-struct __unpacked_format_arg_store {
- basic_format_arg<_Context> __args_[_Np];
-};
-
-} // namespace __format
-
-template <class _Context, class... _Args>
-struct _LIBCPP_TEMPLATE_VIS __format_arg_store {
- _LIBCPP_HIDE_FROM_ABI __format_arg_store(_Args&... __args) noexcept {
- if constexpr (sizeof...(_Args) != 0) {
- if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args)))
- __format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
- else
- __format::__store_basic_format_arg<_Context>(__storage.__args_, __args...);
- }
- }
-
- using _Storage =
- conditional_t<__format::__use_packed_format_arg_store(sizeof...(_Args)),
- __format::__packed_format_arg_store<_Context, sizeof...(_Args)>,
- __format::__unpacked_format_arg_store<_Context, sizeof...(_Args)>>;
-
- _Storage __storage;
-};
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_ARG_STORE_H
diff --git a/libcxx/include/__cxx03/__format/format_args.h b/libcxx/include/__cxx03/__format/format_args.h
deleted file mode 100644
index 702b8763d31e5..0000000000000
--- a/libcxx/include/__cxx03/__format/format_args.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_ARGS_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_ARGS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_arg.h>
-#include <__cxx03/__format/format_arg_store.h>
-#include <__cxx03/__fwd/format.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Context>
-class _LIBCPP_TEMPLATE_VIS basic_format_args {
-public:
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept
- : __size_(sizeof...(_Args)) {
- if constexpr (sizeof...(_Args) != 0) {
- if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args))) {
- __values_ = __store.__storage.__values_;
- __types_ = __store.__storage.__types_;
- } else
- __args_ = __store.__storage.__args_;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
- if (__id >= __size_)
- return basic_format_arg<_Context>{};
-
- if (__format::__use_packed_format_arg_store(__size_))
- return basic_format_arg<_Context>{__format::__get_packed_type(__types_, __id), __values_[__id]};
-
- return __args_[__id];
- }
-
- _LIBCPP_HIDE_FROM_ABI size_t __size() const noexcept { return __size_; }
-
-private:
- size_t __size_{0};
- // [format.args]/5
- // [Note 1: Implementations are encouraged to optimize the representation of
- // basic_format_args for small number of formatting arguments by storing
- // indices of type alternatives separately from values and packing the
- // former. - end note]
- union {
- struct {
- const __basic_format_arg_value<_Context>* __values_;
- uint64_t __types_;
- };
- const basic_format_arg<_Context>* __args_;
- };
-};
-
-template <class _Context, class... _Args>
-basic_format_args(__format_arg_store<_Context, _Args...>) -> basic_format_args<_Context>;
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_ARGS_H
diff --git a/libcxx/include/__cxx03/__format/format_context.h b/libcxx/include/__cxx03/__format/format_context.h
deleted file mode 100644
index 7f1011581133b..0000000000000
--- a/libcxx/include/__cxx03/__format/format_context.h
+++ /dev/null
@@ -1,220 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_CONTEXT_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_CONTEXT_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/buffer.h>
-#include <__cxx03/__format/format_arg.h>
-#include <__cxx03/__format/format_arg_store.h>
-#include <__cxx03/__format/format_args.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__fwd/format.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__variant/monostate.h>
-#include <__cxx03/cstddef>
-
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <__cxx03/__locale>
-# include <__cxx03/optional>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _OutIt, class _CharT>
- requires output_iterator<_OutIt, const _CharT&>
-class _LIBCPP_TEMPLATE_VIS basic_format_context;
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
-/**
- * Helper to create a basic_format_context.
- *
- * This is needed since the constructor is private.
- */
-template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(_OutIt __out_it,
- basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
- optional<std::locale>&& __loc = nullopt) {
- return std::basic_format_context(std::move(__out_it), __args, std::move(__loc));
-}
-# else
-template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
-__format_context_create(_OutIt __out_it, basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
- return std::basic_format_context(std::move(__out_it), __args);
-}
-# endif
-
-using format_context = basic_format_context<back_insert_iterator<__format::__output_buffer<char>>, char>;
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_context = basic_format_context< back_insert_iterator<__format::__output_buffer<wchar_t>>, wchar_t>;
-# endif
-
-template <class _OutIt, class _CharT>
- requires output_iterator<_OutIt, const _CharT&>
-class
- // clang-format off
- _LIBCPP_TEMPLATE_VIS
- _LIBCPP_PREFERRED_NAME(format_context)
- _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context))
- // clang-format on
- basic_format_context {
-public:
- using iterator = _OutIt;
- using char_type = _CharT;
- template <class _Tp>
- using formatter_type = formatter<_Tp, _CharT>;
-
- _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
- return __args_.get(__id);
- }
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- _LIBCPP_HIDE_FROM_ABI std::locale locale() {
- if (!__loc_)
- __loc_ = std::locale{};
- return *__loc_;
- }
-# endif
- _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
- _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
-
-private:
- iterator __out_it_;
- basic_format_args<basic_format_context> __args_;
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
-
- // The Standard doesn't specify how the locale is stored.
- // [format.context]/6
- // std::locale locale();
- // Returns: The locale passed to the formatting function if the latter
- // takes one, and std::locale() otherwise.
- // This is done by storing the locale of the constructor in this optional. If
- // locale() is called and the optional has no value the value will be created.
- // This allows the implementation to lazily create the locale.
- // TODO FMT Validate whether lazy creation is the best solution.
- optional<std::locale> __loc_;
-
- template <class _OtherOutIt, class _OtherCharT>
- friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
- _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
-
- // Note: the Standard doesn't specify the required constructors.
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(
- _OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
- : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
-# else
- template <class _OtherOutIt, class _OtherCharT>
- friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
- __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
- : __out_it_(std::move(__out_it)), __args_(__args) {}
-# endif
-
- basic_format_context(const basic_format_context&) = delete;
- basic_format_context& operator=(const basic_format_context&) = delete;
-};
-
-// A specialization for __retarget_buffer
-//
-// See __retarget_buffer for the motivation for this specialization.
-//
-// This context holds a reference to the instance of the basic_format_context
-// that is retargeted. It converts a formatting argument when it is requested
-// during formatting. It is expected that the usage of the arguments is rare so
-// the lookups are not expected to be used often. An alternative would be to
-// convert all elements during construction.
-//
-// The elements of the retargets context are only used when an underlying
-// formatter uses a locale specific formatting or an formatting argument is
-// part for the format spec. For example
-// format("{:256:{}}", input, 8);
-// Here the width of an element in input is determined dynamically.
-// Note when the top-level element has no width the retargeting is not needed.
-template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> {
-public:
- using iterator = typename __format::__retarget_buffer<_CharT>::__iterator;
- using char_type = _CharT;
- template <class _Tp>
- using formatter_type = formatter<_Tp, _CharT>;
-
- template <class _Context>
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(iterator __out_it, _Context& __ctx)
- : __out_it_(std::move(__out_it)),
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- __loc_([](void* __c) { return static_cast<_Context*>(__c)->locale(); }),
-# endif
- __ctx_(std::addressof(__ctx)),
- __arg_([](void* __c, size_t __id) {
- auto __visitor = [&](auto __arg) -> basic_format_arg<basic_format_context> {
- if constexpr (same_as<decltype(__arg), monostate>)
- return {};
- else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Context>::handle>)
- // At the moment it's not possible for formatting to use a re-targeted handle.
- // TODO FMT add this when support is needed.
- std::__throw_format_error("Re-targeting handle not supported");
- else
- return basic_format_arg<basic_format_context>{
- __format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
- __basic_format_arg_value<basic_format_context>(__arg)};
- };
-# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
- return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor));
-# else
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id));
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
- }) {
- }
-
- _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
- return __arg_(__ctx_, __id);
- }
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- _LIBCPP_HIDE_FROM_ABI std::locale locale() { return __loc_(__ctx_); }
-# endif
- _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
- _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
-
-private:
- iterator __out_it_;
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- std::locale (*__loc_)(void* __ctx);
-# endif
-
- void* __ctx_;
- basic_format_arg<basic_format_context> (*__arg_)(void* __ctx, size_t __id);
-};
-
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_context);
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_CONTEXT_H
diff --git a/libcxx/include/__cxx03/__format/format_error.h b/libcxx/include/__cxx03/__format/format_error.h
deleted file mode 100644
index c0a2959131e48..0000000000000
--- a/libcxx/include/__cxx03/__format/format_error.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_ERROR_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_ERROR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/stdexcept>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
-class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
-public:
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) : runtime_error(__s) {}
- _LIBCPP_HIDE_FROM_ABI format_error(const format_error&) = default;
- _LIBCPP_HIDE_FROM_ABI format_error& operator=(const format_error&) = default;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- ~format_error() noexcept override = default;
-};
-_LIBCPP_DIAGNOSTIC_POP
-
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw format_error(__s);
-# else
- _LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s);
-# endif
-}
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_ERROR_H
diff --git a/libcxx/include/__cxx03/__format/format_functions.h b/libcxx/include/__cxx03/__format/format_functions.h
deleted file mode 100644
index d3a1bc46c8a7d..0000000000000
--- a/libcxx/include/__cxx03/__format/format_functions.h
+++ /dev/null
@@ -1,680 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_FUNCTIONS
-#define _LIBCPP___CXX03___FORMAT_FORMAT_FUNCTIONS
-
-#include <__cxx03/__algorithm/clamp.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/buffer.h>
-#include <__cxx03/__format/format_arg.h>
-#include <__cxx03/__format/format_arg_store.h>
-#include <__cxx03/__format/format_args.h>
-#include <__cxx03/__format/format_context.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/format_string.h>
-#include <__cxx03/__format/format_to_n_result.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_bool.h>
-#include <__cxx03/__format/formatter_char.h>
-#include <__cxx03/__format/formatter_floating_point.h>
-#include <__cxx03/__format/formatter_integer.h>
-#include <__cxx03/__format/formatter_pointer.h>
-#include <__cxx03/__format/formatter_string.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h> // iter_value_t
-#include <__cxx03/__variant/monostate.h>
-#include <__cxx03/array>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <__cxx03/__locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// TODO FMT Evaluate which templates should be external templates. This
-// improves the efficiency of the header. However since the header is still
-// under heavy development and not all classes are stable it makes no sense
-// to do this optimization now.
-
-using format_args = basic_format_args<format_context>;
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_args = basic_format_args<wformat_context>;
-# endif
-
-template <class _Context = format_context, class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
- return std::__format_arg_store<_Context, _Args...>(__args...);
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) {
- return std::__format_arg_store<wformat_context, _Args...>(__args...);
-}
-# endif
-
-namespace __format {
-
-/// Helper class parse and handle argument.
-///
-/// When parsing a handle which is not enabled the code is ill-formed.
-/// This helper uses the parser of the appropriate formatter for the stored type.
-template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __compile_time_handle {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr void __parse(_ParseContext& __ctx) const {
- __parse_(__ctx);
- }
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr void __enable() {
- __parse_ = [](basic_format_parse_context<_CharT>& __ctx) {
- formatter<_Tp, _CharT> __f;
- __ctx.advance_to(__f.parse(__ctx));
- };
- }
-
- // Before calling __parse the proper handler needs to be set with __enable.
- // The default handler isn't a core constant expression.
- _LIBCPP_HIDE_FROM_ABI constexpr __compile_time_handle()
- : __parse_([](basic_format_parse_context<_CharT>&) { std::__throw_format_error("Not a handle"); }) {}
-
-private:
- void (*__parse_)(basic_format_parse_context<_CharT>&);
-};
-
-// Dummy format_context only providing the parts used during constant
-// validation of the basic_format_string.
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __compile_time_basic_format_context {
-public:
- using char_type = _CharT;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __compile_time_basic_format_context(
- const __arg_t* __args, const __compile_time_handle<_CharT>* __handles, size_t __size)
- : __args_(__args), __handles_(__handles), __size_(__size) {}
-
- // During the compile-time validation nothing needs to be written.
- // Therefore all operations of this iterator are a NOP.
- struct iterator {
- _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator=(_CharT) { return *this; }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator& operator*() { return *this; }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator operator++(int) { return *this; }
- };
-
- _LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const {
- if (__id >= __size_)
- std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
- return __args_[__id];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const {
- if (__id >= __size_)
- std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
- return __handles_[__id];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator out() { return {}; }
- _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(iterator) {}
-
-private:
- const __arg_t* __args_;
- const __compile_time_handle<_CharT>* __handles_;
- size_t __size_;
-};
-
-// [format.string.std]/8
-// If { arg-idopt } is used in a width or precision, the value of the
-// corresponding formatting argument is used in its place. If the
-// corresponding formatting argument is not of standard signed or unsigned
-// integer type, or its value is negative for precision or non-positive for
-// width, an exception of type format_error is thrown.
-//
-// _HasPrecision does the formatter have a precision?
-template <class _CharT, class _Tp, bool _HasPrecision = false>
-_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_validate_argument(
- basic_format_parse_context<_CharT>& __parse_ctx, __compile_time_basic_format_context<_CharT>& __ctx) {
- auto __validate_type = [](__arg_t __type) {
- // LWG3720 originally allowed "signed or unsigned integer types", however
- // the final version explicitly changed it to "*standard* signed or unsigned
- // integer types". It's trivial to use 128-bit integrals in libc++'s
- // implementation, but other implementations may not implement it.
- // (Using a width or precision, that does not fit in 64-bits, sounds very
- // unlikely in real world code.)
- switch (__type) {
- case __arg_t::__int:
- case __arg_t::__long_long:
- case __arg_t::__unsigned:
- case __arg_t::__unsigned_long_long:
- return;
-
- default:
- std::__throw_format_error("Replacement argument isn't a standard signed or unsigned integer type");
- }
- };
-
- formatter<_Tp, _CharT> __formatter;
- __parse_ctx.advance_to(__formatter.parse(__parse_ctx));
- if (__formatter.__parser_.__width_as_arg_)
- __validate_type(__ctx.arg(__formatter.__parser_.__width_));
-
- if constexpr (_HasPrecision)
- if (__formatter.__parser_.__precision_as_arg_)
- __validate_type(__ctx.arg(__formatter.__parser_.__precision_));
-}
-
-// This function is not user facing, so it can directly use the non-standard types of the "variant".
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(
- basic_format_parse_context<_CharT>& __parse_ctx,
- __compile_time_basic_format_context<_CharT>& __ctx,
- __arg_t __type) {
- switch (__type) {
- case __arg_t::__none:
- std::__throw_format_error("Invalid argument");
- case __arg_t::__boolean:
- return __format::__compile_time_validate_argument<_CharT, bool>(__parse_ctx, __ctx);
- case __arg_t::__char_type:
- return __format::__compile_time_validate_argument<_CharT, _CharT>(__parse_ctx, __ctx);
- case __arg_t::__int:
- return __format::__compile_time_validate_argument<_CharT, int>(__parse_ctx, __ctx);
- case __arg_t::__long_long:
- return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx);
- case __arg_t::__i128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx);
-# else
- std::__throw_format_error("Invalid argument");
-# endif
- return;
- case __arg_t::__unsigned:
- return __format::__compile_time_validate_argument<_CharT, unsigned>(__parse_ctx, __ctx);
- case __arg_t::__unsigned_long_long:
- return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx);
- case __arg_t::__u128:
-# ifndef _LIBCPP_HAS_NO_INT128
- return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx);
-# else
- std::__throw_format_error("Invalid argument");
-# endif
- return;
- case __arg_t::__float:
- return __format::__compile_time_validate_argument<_CharT, float, true>(__parse_ctx, __ctx);
- case __arg_t::__double:
- return __format::__compile_time_validate_argument<_CharT, double, true>(__parse_ctx, __ctx);
- case __arg_t::__long_double:
- return __format::__compile_time_validate_argument<_CharT, long double, true>(__parse_ctx, __ctx);
- case __arg_t::__const_char_type_ptr:
- return __format::__compile_time_validate_argument<_CharT, const _CharT*, true>(__parse_ctx, __ctx);
- case __arg_t::__string_view:
- return __format::__compile_time_validate_argument<_CharT, basic_string_view<_CharT>, true>(__parse_ctx, __ctx);
- case __arg_t::__ptr:
- return __format::__compile_time_validate_argument<_CharT, const void*>(__parse_ctx, __ctx);
- case __arg_t::__handle:
- std::__throw_format_error("Handle should use __compile_time_validate_handle_argument");
- }
- std::__throw_format_error("Invalid argument");
-}
-
-template <contiguous_iterator _Iterator, class _ParseCtx, class _Ctx>
-_LIBCPP_HIDE_FROM_ABI constexpr _Iterator
-__handle_replacement_field(_Iterator __begin, _Iterator __end, _ParseCtx& __parse_ctx, _Ctx& __ctx) {
- using _CharT = iter_value_t<_Iterator>;
- __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
-
- if (__r.__last == __end)
- std::__throw_format_error("The argument index should end with a ':' or a '}'");
-
- bool __parse = *__r.__last == _CharT(':');
- switch (*__r.__last) {
- case _CharT(':'):
- // The arg-id has a format-specifier, advance the input to the format-spec.
- __parse_ctx.advance_to(__r.__last + 1);
- break;
- case _CharT('}'):
- // The arg-id has no format-specifier.
- __parse_ctx.advance_to(__r.__last);
- break;
- default:
- std::__throw_format_error("The argument index should end with a ':' or a '}'");
- }
-
- if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) {
- __arg_t __type = __ctx.arg(__r.__value);
- if (__type == __arg_t::__none)
- std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
- else if (__type == __arg_t::__handle)
- __ctx.__handle(__r.__value).__parse(__parse_ctx);
- else if (__parse)
- __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type);
- } else
- std::__visit_format_arg(
- [&](auto __arg) {
- if constexpr (same_as<decltype(__arg), monostate>)
- std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
- else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>)
- __arg.format(__parse_ctx, __ctx);
- else {
- formatter<decltype(__arg), _CharT> __formatter;
- if (__parse)
- __parse_ctx.advance_to(__formatter.parse(__parse_ctx));
- __ctx.advance_to(__formatter.format(__arg, __ctx));
- }
- },
- __ctx.arg(__r.__value));
-
- __begin = __parse_ctx.begin();
- if (__begin == __end || *__begin != _CharT('}'))
- std::__throw_format_error("The replacement field misses a terminating '}'");
-
- return ++__begin;
-}
-
-template <class _ParseCtx, class _Ctx>
-_LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&& __parse_ctx, _Ctx&& __ctx) {
- using _CharT = typename _ParseCtx::char_type;
- static_assert(same_as<typename _Ctx::char_type, _CharT>);
-
- auto __begin = __parse_ctx.begin();
- auto __end = __parse_ctx.end();
- typename _Ctx::iterator __out_it = __ctx.out();
- while (__begin != __end) {
- switch (*__begin) {
- case _CharT('{'):
- ++__begin;
- if (__begin == __end)
- std::__throw_format_error("The format string terminates at a '{'");
-
- if (*__begin != _CharT('{')) [[likely]] {
- __ctx.advance_to(std::move(__out_it));
- __begin = __format::__handle_replacement_field(__begin, __end, __parse_ctx, __ctx);
- __out_it = __ctx.out();
-
- // The output is written and __begin points to the next character. So
- // start the next iteration.
- continue;
- }
- // The string is an escape character.
- break;
-
- case _CharT('}'):
- ++__begin;
- if (__begin == __end || *__begin != _CharT('}'))
- std::__throw_format_error("The format string contains an invalid escape sequence");
-
- break;
- }
-
- // Copy the character to the output verbatim.
- *__out_it++ = *__begin++;
- }
- return __out_it;
-}
-
-} // namespace __format
-
-# if _LIBCPP_STD_VER >= 26
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __runtime_format_string {
-private:
- basic_string_view<_CharT> __str_;
-
- template <class _Cp, class... _Args>
- friend struct _LIBCPP_TEMPLATE_VIS basic_format_string;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __runtime_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
-
- __runtime_format_string(const __runtime_format_string&) = delete;
- __runtime_format_string& operator=(const __runtime_format_string&) = delete;
-};
-
-_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<char> runtime_format(string_view __fmt) noexcept { return __fmt; }
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wstring_view __fmt) noexcept {
- return __fmt;
-}
-# endif
-# endif //_LIBCPP_STD_VER >= 26
-
-template <class _CharT, class... _Args>
-struct _LIBCPP_TEMPLATE_VIS basic_format_string {
- template <class _Tp>
- requires convertible_to<const _Tp&, basic_string_view<_CharT>>
- consteval basic_format_string(const _Tp& __str) : __str_{__str} {
- __format::__vformat_to(basic_format_parse_context<_CharT>{__str_, sizeof...(_Args)},
- _Context{__types_.data(), __handles_.data(), sizeof...(_Args)});
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
-# endif
-
-private:
- basic_string_view<_CharT> __str_;
-
- using _Context = __format::__compile_time_basic_format_context<_CharT>;
-
- static constexpr array<__format::__arg_t, sizeof...(_Args)> __types_{
- __format::__determine_arg_t<_Context, remove_cvref_t<_Args>>()...};
-
- static constexpr array<__format::__compile_time_handle<_CharT>, sizeof...(_Args)> __handles_{[] {
- using _Tp = remove_cvref_t<_Args>;
- __format::__compile_time_handle<_CharT> __handle;
- if (__format::__determine_arg_t<_Context, _Tp>() == __format::__arg_t::__handle)
- __handle.template __enable<_Tp>();
-
- return __handle;
- }()...};
-};
-
-template <class... _Args>
-using format_string = basic_format_string<char, type_identity_t<_Args>...>;
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
-# endif
-
-template <class _OutIt, class _CharT, class _FormatOutIt>
- requires(output_iterator<_OutIt, const _CharT&>)
-_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
- basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
- if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()}, std::__format_context_create(std::move(__out_it), __args));
- else {
- __format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
- std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
- return std::move(__buffer).__out_it();
- }
-}
-
-// The function is _LIBCPP_ALWAYS_INLINE since the compiler is bad at inlining
-// https://reviews.llvm.org/D110499#inline-1180704
-// TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
-template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
- return std::__vformat_to(std::move(__out_it), __fmt, __args);
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
- return std::__vformat_to(std::move(__out_it), __fmt, __args);
-}
-# endif
-
-template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
-// fires too eagerly, see http://llvm.org/PR61563.
-template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(string_view __fmt, format_args __args) {
- string __res;
- std::vformat_to(std::back_inserter(__res), __fmt, __args);
- return __res;
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
-// fires too eagerly, see http://llvm.org/PR61563.
-template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
-vformat(wstring_view __fmt, wformat_args __args) {
- wstring __res;
- std::vformat_to(std::back_inserter(__res), __fmt, __args);
- return __res;
-}
-# endif
-
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
-format(format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(__fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
-format(wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(__fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-__vformat_to_n(_OutIt __out_it,
- iter_difference_t<_OutIt> __n,
- basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
- __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
- std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
- return std::move(__buffer).__result();
-}
-
-template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformat_to_n<format_context>(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
-format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, __fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) {
- __format::__formatted_size_buffer<_CharT> __buffer;
- std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args));
- return std::move(__buffer).__result();
-}
-
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(format_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_format_args(__args...)});
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
-}
-# endif
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
-
-template <class _OutIt, class _CharT, class _FormatOutIt>
- requires(output_iterator<_OutIt, const _CharT&>)
-_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(
- _OutIt __out_it,
- locale __loc,
- basic_string_view<_CharT> __fmt,
- basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
- if constexpr (same_as<_OutIt, _FormatOutIt>)
- return std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(std::move(__out_it), __args, std::move(__loc)));
- else {
- __format::__format_buffer<_OutIt, _CharT> __buffer{std::move(__out_it)};
- std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args, std::move(__loc)));
- return std::move(__buffer).__out_it();
- }
-}
-
-template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
- return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
-}
-# endif
-
-template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
-// fires too eagerly, see http://llvm.org/PR61563.
-template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
-vformat(locale __loc, string_view __fmt, format_args __args) {
- string __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
- return __res;
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
-// fires too eagerly, see http://llvm.org/PR61563.
-template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
-vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
- wstring __res;
- std::vformat_to(std::back_inserter(__res), std::move(__loc), __fmt, __args);
- return __res;
-}
-# endif
-
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
-format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
-format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::vformat(std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(
- _OutIt __out_it,
- iter_difference_t<_OutIt> __n,
- locale __loc,
- basic_string_view<_CharT> __fmt,
- basic_format_args<_Context> __args) {
- __format::__format_to_n_buffer<_OutIt, _CharT> __buffer{std::move(__out_it), __n};
- std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args, std::move(__loc)));
- return std::move(__buffer).__result();
-}
-
-template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
- _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformat_to_n<format_context>(
- std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_format_args(__args...));
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(
- _OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformat_to_n<wformat_context>(
- std::move(__out_it), __n, std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
-}
-# endif
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(locale __loc, basic_string_view<_CharT> __fmt, auto __args) {
- __format::__formatted_size_buffer<_CharT> __buffer;
- std::__format::__vformat_to(
- basic_format_parse_context{__fmt, __args.__size()},
- std::__format_context_create(__buffer.__make_output_iterator(), __args, std::move(__loc)));
- return std::move(__buffer).__result();
-}
-
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformatted_size(std::move(__loc), __fmt.get(), basic_format_args{std::make_format_args(__args...)});
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
- return std::__vformatted_size(std::move(__loc), __fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
-}
-# endif
-
-# endif // _LIBCPP_HAS_NO_LOCALIZATION
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_FUNCTIONS
diff --git a/libcxx/include/__cxx03/__format/format_parse_context.h b/libcxx/include/__cxx03/__format/format_parse_context.h
deleted file mode 100644
index 81338506aee69..0000000000000
--- a/libcxx/include/__cxx03/__format/format_parse_context.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_PARSE_CONTEXT_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_PARSE_CONTEXT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__type_traits/is_constant_evaluated.h>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS basic_format_parse_context {
-public:
- using char_type = _CharT;
- using const_iterator = typename basic_string_view<_CharT>::const_iterator;
- using iterator = const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_parse_context(
- basic_string_view<_CharT> __fmt, size_t __num_args = 0) noexcept
- : __begin_(__fmt.begin()),
- __end_(__fmt.end()),
- __indexing_(__unknown),
- __next_arg_id_(0),
- __num_args_(__num_args) {}
-
- basic_format_parse_context(const basic_format_parse_context&) = delete;
- basic_format_parse_context& operator=(const basic_format_parse_context&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept { return __begin_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept { return __end_; }
- _LIBCPP_HIDE_FROM_ABI constexpr void advance_to(const_iterator __it) { __begin_ = __it; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_t next_arg_id() {
- if (__indexing_ == __manual)
- std::__throw_format_error("Using automatic argument numbering in manual argument numbering mode");
-
- if (__indexing_ == __unknown)
- __indexing_ = __automatic;
-
- // Throws an exception to make the expression a non core constant
- // expression as required by:
- // [format.parse.ctx]/8
- // Remarks: Let cur-arg-id be the value of next_arg_id_ prior to this
- // call. Call expressions where cur-arg-id >= num_args_ is true are not
- // core constant expressions (7.7 [expr.const]).
- // Note: the Throws clause [format.parse.ctx]/9 doesn't specify the
- // behavior when id >= num_args_.
- if (is_constant_evaluated() && __next_arg_id_ >= __num_args_)
- std::__throw_format_error("Argument index outside the valid range");
-
- return __next_arg_id_++;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void check_arg_id(size_t __id) {
- if (__indexing_ == __automatic)
- std::__throw_format_error("Using manual argument numbering in automatic argument numbering mode");
-
- if (__indexing_ == __unknown)
- __indexing_ = __manual;
-
- // Throws an exception to make the expression a non core constant
- // expression as required by:
- // [format.parse.ctx]/11
- // Remarks: Call expressions where id >= num_args_ are not core constant
- // expressions ([expr.const]).
- // Note: the Throws clause [format.parse.ctx]/10 doesn't specify the
- // behavior when id >= num_args_.
- if (is_constant_evaluated() && __id >= __num_args_)
- std::__throw_format_error("Argument index outside the valid range");
- }
-
-private:
- iterator __begin_;
- iterator __end_;
- enum _Indexing { __unknown, __manual, __automatic };
- _Indexing __indexing_;
- size_t __next_arg_id_;
- size_t __num_args_;
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_parse_context);
-
-using format_parse_context = basic_format_parse_context<char>;
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using wformat_parse_context = basic_format_parse_context<wchar_t>;
-# endif
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_PARSE_CONTEXT_H
diff --git a/libcxx/include/__cxx03/__format/format_string.h b/libcxx/include/__cxx03/__format/format_string.h
deleted file mode 100644
index 6a7276419167a..0000000000000
--- a/libcxx/include/__cxx03/__format/format_string.h
+++ /dev/null
@@ -1,160 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_STRING_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_STRING_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h> // iter_value_t
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format {
-
-template <contiguous_iterator _Iterator>
-struct _LIBCPP_TEMPLATE_VIS __parse_number_result {
- _Iterator __last;
- uint32_t __value;
-};
-
-template <contiguous_iterator _Iterator>
-__parse_number_result(_Iterator, uint32_t) -> __parse_number_result<_Iterator>;
-
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> __parse_number(_Iterator __begin, _Iterator __end);
-
-/**
- * The maximum value of a numeric argument.
- *
- * This is used for:
- * * arg-id
- * * width as value or arg-id.
- * * precision as value or arg-id.
- *
- * The value is compatible with the maximum formatting width and precision
- * using the `%*` syntax on a 32-bit system.
- */
-inline constexpr uint32_t __number_max = INT32_MAX;
-
-namespace __detail {
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_zero(_Iterator __begin, _Iterator, auto& __parse_ctx) {
- __parse_ctx.check_arg_id(0);
- return {++__begin, 0}; // can never be larger than the maximum.
-}
-
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_automatic(_Iterator __begin, _Iterator, auto& __parse_ctx) {
- size_t __value = __parse_ctx.next_arg_id();
- _LIBCPP_ASSERT_UNCATEGORIZED(__value <= __number_max, "Compilers don't support this number of arguments");
-
- return {__begin, uint32_t(__value)};
-}
-
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_manual(_Iterator __begin, _Iterator __end, auto& __parse_ctx) {
- __parse_number_result<_Iterator> __r = __format::__parse_number(__begin, __end);
- __parse_ctx.check_arg_id(__r.__value);
- return __r;
-}
-
-} // namespace __detail
-
-/**
- * Parses a number.
- *
- * The number is used for the 31-bit values @em width and @em precision. This
- * allows a maximum value of 2147483647.
- */
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_number(_Iterator __begin, _Iterator __end_input) {
- using _CharT = iter_value_t<_Iterator>;
- static_assert(__format::__number_max == INT32_MAX, "The algorithm is implemented based on this value.");
- /*
- * Limit the input to 9 digits, otherwise we need two checks during every
- * iteration:
- * - Are we at the end of the input?
- * - Does the value exceed width of an uint32_t? (Switching to uint64_t would
- * have the same issue, but with a higher maximum.)
- */
- _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input;
- uint32_t __value = *__begin - _CharT('0');
- while (++__begin != __end) {
- if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- return {__begin, __value};
-
- __value = __value * 10 + *__begin - _CharT('0');
- }
-
- if (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')) {
- /*
- * There are more than 9 digits, do additional validations:
- * - Does the 10th digit exceed the maximum allowed value?
- * - Are there more than 10 digits?
- * (More than 10 digits always overflows the maximum.)
- */
- uint64_t __v = uint64_t(__value) * 10 + *__begin++ - _CharT('0');
- if (__v > __number_max || (__begin != __end_input && *__begin >= _CharT('0') && *__begin <= _CharT('9')))
- std::__throw_format_error("The numeric value of the format specifier is too large");
-
- __value = __v;
- }
-
- return {__begin, __value};
-}
-
-/**
- * Multiplexer for all parse functions.
- *
- * The parser will return a pointer beyond the last consumed character. This
- * should be the closing '}' of the arg-id.
- */
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator>
-__parse_arg_id(_Iterator __begin, _Iterator __end, auto& __parse_ctx) {
- using _CharT = iter_value_t<_Iterator>;
- switch (*__begin) {
- case _CharT('0'):
- return __detail::__parse_zero(__begin, __end, __parse_ctx);
-
- case _CharT(':'):
- // This case is conditionally valid. It's allowed in an arg-id in the
- // replacement-field, but not in the std-format-spec. The caller can
- // provide a better diagnostic, so accept it here unconditionally.
- case _CharT('}'):
- return __detail::__parse_automatic(__begin, __end, __parse_ctx);
- }
- if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- std::__throw_format_error("The argument index starts with an invalid character");
-
- return __detail::__parse_manual(__begin, __end, __parse_ctx);
-}
-
-} // namespace __format
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_STRING_H
diff --git a/libcxx/include/__cxx03/__format/format_to_n_result.h b/libcxx/include/__cxx03/__format/format_to_n_result.h
deleted file mode 100644
index 65e7031f57648..0000000000000
--- a/libcxx/include/__cxx03/__format/format_to_n_result.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMAT_TO_N_RESULT_H
-#define _LIBCPP___CXX03___FORMAT_FORMAT_TO_N_RESULT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/incrementable_traits.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 _OutIt>
-struct _LIBCPP_TEMPLATE_VIS format_to_n_result {
- _OutIt out;
- iter_difference_t<_OutIt> size;
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(format_to_n_result);
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMAT_TO_N_RESULT_H
diff --git a/libcxx/include/__cxx03/__format/formatter.h b/libcxx/include/__cxx03/__format/formatter.h
deleted file mode 100644
index 9afc9dfce3cb5..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/format.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-/// The default formatter template.
-///
-/// [format.formatter.spec]/5
-/// If F is a disabled specialization of formatter, these values are false:
-/// - is_default_constructible_v<F>,
-/// - is_copy_constructible_v<F>,
-/// - is_move_constructible_v<F>,
-/// - is_copy_assignable<F>, and
-/// - is_move_assignable<F>.
-template <class _Tp, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter {
- formatter() = delete;
- formatter(const formatter&) = delete;
- formatter& operator=(const formatter&) = delete;
-};
-
-# if _LIBCPP_STD_VER >= 23
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {
- if constexpr (requires { __formatter.set_debug_format(); })
- __formatter.set_debug_format();
-}
-
-# endif // _LIBCPP_STD_VER >= 23
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_H
diff --git a/libcxx/include/__cxx03/__format/formatter_bool.h b/libcxx/include/__cxx03/__format/formatter_bool.h
deleted file mode 100644
index 12a29c2c56040..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_bool.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_BOOL_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_BOOL_H
-
-#include <__cxx03/__algorithm/copy.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__utility/unreachable.h>
-
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <__cxx03/__locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<bool, _CharT> {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral);
- __format_spec::__process_parsed_bool(__parser_, "a bool");
- return __result;
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const {
- switch (__parser_.__type_) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__string:
- return __formatter::__format_bool(__value, __ctx, __parser_.__get_parsed_std_specifications(__ctx));
-
- case __format_spec::__type::__binary_lower_case:
- case __format_spec::__type::__binary_upper_case:
- case __format_spec::__type::__octal:
- case __format_spec::__type::__decimal:
- case __format_spec::__type::__hexadecimal_lower_case:
- case __format_spec::__type::__hexadecimal_upper_case:
- // Promotes bool to an integral type. This reduces the number of
- // instantiations of __format_integer reducing code size.
- return __formatter::__format_integer(
- static_cast<unsigned>(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx));
-
- default:
- _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type");
- __libcpp_unreachable();
- }
- }
-
- __format_spec::__parser<_CharT> __parser_;
-};
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_BOOL_H
diff --git a/libcxx/include/__cxx03/__format/formatter_char.h b/libcxx/include/__cxx03/__format/formatter_char.h
deleted file mode 100644
index f0a7d153ea343..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_char.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_CHAR_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_CHAR_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__format/write_escaped.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_char {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral);
- __format_spec::__process_parsed_char(__parser_, "a character");
- return __result;
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_CharT __value, _FormatContext& __ctx) const {
- if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char)
- return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
-
-# if _LIBCPP_STD_VER >= 23
- if (__parser_.__type_ == __format_spec::__type::__debug)
- return __formatter::__format_escaped_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
-# endif
-
- if constexpr (sizeof(_CharT) <= sizeof(unsigned))
- return __formatter::__format_integer(
- static_cast<unsigned>(static_cast<make_unsigned_t<_CharT>>(__value)),
- __ctx,
- __parser_.__get_parsed_std_specifications(__ctx));
- else
- return __formatter::__format_integer(
- static_cast<make_unsigned_t<_CharT>>(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx));
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(char __value, _FormatContext& __ctx) const
- requires(same_as<_CharT, wchar_t>)
- {
- return format(static_cast<wchar_t>(static_cast<unsigned char>(__value)), __ctx);
- }
-
-# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; }
-# endif
-
- __format_spec::__parser<_CharT> __parser_;
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS formatter<char, char> : public __formatter_char<char> {};
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <>
-struct _LIBCPP_TEMPLATE_VIS formatter<char, wchar_t> : public __formatter_char<wchar_t> {};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS formatter<wchar_t, wchar_t> : public __formatter_char<wchar_t> {};
-
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_CHAR_H
diff --git a/libcxx/include/__cxx03/__format/formatter_floating_point.h b/libcxx/include/__cxx03/__format/formatter_floating_point.h
deleted file mode 100644
index 9f7eec0addcf2..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_floating_point.h
+++ /dev/null
@@ -1,783 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_FLOATING_POINT_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_FLOATING_POINT_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__algorithm/find.h>
-#include <__cxx03/__algorithm/max.h>
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__algorithm/rotate.h>
-#include <__cxx03/__algorithm/transform.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__charconv/chars_format.h>
-#include <__cxx03/__charconv/to_chars_floating_point.h>
-#include <__cxx03/__charconv/to_chars_result.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/cmath>
-#include <__cxx03/cstddef>
-
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <__cxx03/__locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __formatter {
-
-template <floating_point _Tp>
-_LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value) {
- to_chars_result __r = std::to_chars(__first, __last, __value);
- _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small");
- return __r.ptr;
-}
-
-template <floating_point _Tp>
-_LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt) {
- to_chars_result __r = std::to_chars(__first, __last, __value, __fmt);
- _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small");
- return __r.ptr;
-}
-
-template <floating_point _Tp>
-_LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt, int __precision) {
- to_chars_result __r = std::to_chars(__first, __last, __value, __fmt, __precision);
- _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small");
- return __r.ptr;
-}
-
-// https://en.cppreference.com/w/cpp/language/types#cite_note-1
-// float min subnormal: +/-0x1p-149 max: +/- 3.402,823,4 10^38
-// double min subnormal: +/-0x1p-1074 max +/- 1.797,693,134,862,315,7 10^308
-// long double (x86) min subnormal: +/-0x1p-16446 max: +/- 1.189,731,495,357,231,765,021 10^4932
-//
-// The maximum number of digits required for the integral part is based on the
-// maximum's value power of 10. Every power of 10 requires one additional
-// decimal digit.
-// The maximum number of digits required for the fractional part is based on
-// the minimal subnormal hexadecimal output's power of 10. Every division of a
-// fraction's binary 1 by 2, requires one additional decimal digit.
-//
-// The maximum size of a formatted value depends on the selected output format.
-// Ignoring the fact the format string can request a precision larger than the
-// values maximum required, these values are:
-//
-// sign 1 code unit
-// __max_integral
-// radix point 1 code unit
-// __max_fractional
-// exponent character 1 code unit
-// sign 1 code unit
-// __max_fractional_value
-// -----------------------------------
-// total 4 code units extra required.
-//
-// TODO FMT Optimize the storage to avoid storing digits that are known to be zero.
-// https://www.exploringbinary.com/maximum-number-of-decimal-digits-in-binary-floating-point-numbers/
-
-// TODO FMT Add long double specialization when to_chars has proper long double support.
-template <class _Tp>
-struct __traits;
-
-template <floating_point _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr size_t __float_buffer_size(int __precision) {
- using _Traits = __traits<_Fp>;
- return 4 + _Traits::__max_integral + __precision + _Traits::__max_fractional_value;
-}
-
-template <>
-struct __traits<float> {
- static constexpr int __max_integral = 38;
- static constexpr int __max_fractional = 149;
- static constexpr int __max_fractional_value = 3;
- static constexpr size_t __stack_buffer_size = 256;
-
- static constexpr int __hex_precision_digits = 3;
-};
-
-template <>
-struct __traits<double> {
- static constexpr int __max_integral = 308;
- static constexpr int __max_fractional = 1074;
- static constexpr int __max_fractional_value = 4;
- static constexpr size_t __stack_buffer_size = 1024;
-
- static constexpr int __hex_precision_digits = 4;
-};
-
-/// Helper class to store the conversion buffer.
-///
-/// Depending on the maximum size required for a value, the buffer is allocated
-/// on the stack or the heap.
-template <floating_point _Fp>
-class _LIBCPP_TEMPLATE_VIS __float_buffer {
- using _Traits = __traits<_Fp>;
-
-public:
- // TODO FMT Improve this constructor to do a better estimate.
- // When using a scientific formatting with a precision of 6 a stack buffer
- // will always suffice. At the moment that isn't important since floats and
- // doubles use a stack buffer, unless the precision used in the format string
- // is large.
- // When supporting long doubles the __max_integral part becomes 4932 which
- // may be too much for some platforms. For these cases a better estimate is
- // required.
- explicit _LIBCPP_HIDE_FROM_ABI __float_buffer(int __precision)
- : __precision_(__precision != -1 ? __precision : _Traits::__max_fractional) {
- // When the precision is larger than _Traits::__max_fractional the digits in
- // the range (_Traits::__max_fractional, precision] will contain the value
- // zero. There's no need to request to_chars to write these zeros:
- // - When the value is large a temporary heap buffer needs to be allocated.
- // - When to_chars writes the values they need to be "copied" to the output:
- // - char: std::fill on the output iterator is faster than std::copy.
- // - wchar_t: same argument as char, but additional std::copy won't work.
- // The input is always a char buffer, so every char in the buffer needs
- // to be converted from a char to a wchar_t.
- if (__precision_ > _Traits::__max_fractional) {
- __num_trailing_zeros_ = __precision_ - _Traits::__max_fractional;
- __precision_ = _Traits::__max_fractional;
- }
-
- __size_ = __formatter::__float_buffer_size<_Fp>(__precision_);
- if (__size_ > _Traits::__stack_buffer_size)
- // The allocated buffer's contents don't need initialization.
- __begin_ = allocator<char>{}.allocate(__size_);
- else
- __begin_ = __buffer_;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__float_buffer() {
- if (__size_ > _Traits::__stack_buffer_size)
- allocator<char>{}.deallocate(__begin_, __size_);
- }
- _LIBCPP_HIDE_FROM_ABI __float_buffer(const __float_buffer&) = delete;
- _LIBCPP_HIDE_FROM_ABI __float_buffer& operator=(const __float_buffer&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI char* begin() const { return __begin_; }
- _LIBCPP_HIDE_FROM_ABI char* end() const { return __begin_ + __size_; }
-
- _LIBCPP_HIDE_FROM_ABI int __precision() const { return __precision_; }
- _LIBCPP_HIDE_FROM_ABI int __num_trailing_zeros() const { return __num_trailing_zeros_; }
- _LIBCPP_HIDE_FROM_ABI void __remove_trailing_zeros() { __num_trailing_zeros_ = 0; }
- _LIBCPP_HIDE_FROM_ABI void __add_trailing_zeros(int __zeros) { __num_trailing_zeros_ += __zeros; }
-
-private:
- int __precision_;
- int __num_trailing_zeros_{0};
- size_t __size_;
- char* __begin_;
- char __buffer_[_Traits::__stack_buffer_size];
-};
-
-struct __float_result {
- /// Points at the beginning of the integral part in the buffer.
- ///
- /// When there's no sign character this points at the start of the buffer.
- char* __integral;
-
- /// Points at the radix point, when not present it's the same as \ref __last.
- char* __radix_point;
-
- /// Points at the exponent character, when not present it's the same as \ref __last.
- char* __exponent;
-
- /// Points beyond the last written element in the buffer.
- char* __last;
-};
-
-/// Finds the position of the exponent character 'e' at the end of the buffer.
-///
-/// Assuming there is an exponent the input will terminate with
-/// eSdd and eSdddd (S = sign, d = digit)
-///
-/// \returns a pointer to the exponent or __last when not found.
-constexpr inline _LIBCPP_HIDE_FROM_ABI char* __find_exponent(char* __first, char* __last) {
- ptrdiff_t __size = __last - __first;
- if (__size >= 4) {
- __first = __last - std::min(__size, ptrdiff_t(6));
- for (; __first != __last - 3; ++__first) {
- if (*__first == 'e')
- return __first;
- }
- }
- return __last;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result
-__format_buffer_default(const __float_buffer<_Fp>& __buffer, _Tp __value, char* __integral) {
- __float_result __result;
- __result.__integral = __integral;
- __result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value);
-
- __result.__exponent = __formatter::__find_exponent(__result.__integral, __result.__last);
-
- // Constrains:
- // - There's at least one decimal digit before the radix point.
- // - The radix point, when present, is placed before the exponent.
- __result.__radix_point = std::find(__result.__integral + 1, __result.__exponent, '.');
-
- // When the radix point isn't found its position is the exponent instead of
- // __result.__last.
- if (__result.__radix_point == __result.__exponent)
- __result.__radix_point = __result.__last;
-
- // clang-format off
- _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) &&
- (__result.__radix_point == __result.__last || *__result.__radix_point == '.') &&
- (__result.__exponent == __result.__last || *__result.__exponent == 'e'),
- "Post-condition failure.");
- // clang-format on
-
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(
- const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result;
- __result.__integral = __integral;
- if (__precision == -1)
- __result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::hex);
- else
- __result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::hex, __precision);
-
- // H = one or more hex-digits
- // S = sign
- // D = one or more decimal-digits
- // When the fractional part is zero and no precision the output is 0p+0
- // else the output is 0.HpSD
- // So testing the second position can differentiate between these two cases.
- char* __first = __integral + 1;
- if (*__first == '.') {
- __result.__radix_point = __first;
- // One digit is the minimum
- // 0.hpSd
- // ^-- last
- // ^---- integral = end of search
- // ^-------- start of search
- // 0123456
- //
- // Four digits is the maximum
- // 0.hpSdddd
- // ^-- last
- // ^---- integral = end of search
- // ^-------- start of search
- // 0123456789
- static_assert(__traits<_Fp>::__hex_precision_digits <= 4, "Guard against possible underflow.");
-
- char* __last = __result.__last - 2;
- __first = __last - __traits<_Fp>::__hex_precision_digits;
- __result.__exponent = std::find(__first, __last, 'p');
- } else {
- __result.__radix_point = __result.__last;
- __result.__exponent = __first;
- }
-
- // clang-format off
- _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) &&
- (__result.__radix_point == __result.__last || *__result.__radix_point == '.') &&
- (__result.__exponent != __result.__last && *__result.__exponent == 'p'),
- "Post-condition failure.");
- // clang-format on
-
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_upper_case(
- const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result =
- __formatter::__format_buffer_hexadecimal_lower_case(__buffer, __value, __precision, __integral);
- std::transform(__result.__integral, __result.__exponent, __result.__integral, __hex_to_upper);
- *__result.__exponent = 'P';
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(
- const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result;
- __result.__integral = __integral;
- __result.__last =
- __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::scientific, __precision);
-
- char* __first = __integral + 1;
- _LIBCPP_ASSERT_INTERNAL(__first != __result.__last, "No exponent present");
- if (*__first == '.') {
- __result.__radix_point = __first;
- __result.__exponent = __formatter::__find_exponent(__first + 1, __result.__last);
- } else {
- __result.__radix_point = __result.__last;
- __result.__exponent = __first;
- }
-
- // clang-format off
- _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) &&
- (__result.__radix_point == __result.__last || *__result.__radix_point == '.') &&
- (__result.__exponent != __result.__last && *__result.__exponent == 'e'),
- "Post-condition failure.");
- // clang-format on
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_upper_case(
- const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result =
- __formatter::__format_buffer_scientific_lower_case(__buffer, __value, __precision, __integral);
- *__result.__exponent = 'E';
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result
-__format_buffer_fixed(const __float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result;
- __result.__integral = __integral;
- __result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::fixed, __precision);
-
- // When there's no precision there's no radix point.
- // Else the radix point is placed at __precision + 1 from the end.
- // By converting __precision to a bool the subtraction can be done
- // unconditionally.
- __result.__radix_point = __result.__last - (__precision + bool(__precision));
- __result.__exponent = __result.__last;
-
- // clang-format off
- _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) &&
- (__result.__radix_point == __result.__last || *__result.__radix_point == '.') &&
- (__result.__exponent == __result.__last),
- "Post-condition failure.");
- // clang-format on
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result
-__format_buffer_general_lower_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __buffer.__remove_trailing_zeros();
-
- __float_result __result;
- __result.__integral = __integral;
- __result.__last = __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::general, __precision);
-
- char* __first = __integral + 1;
- if (__first == __result.__last) {
- __result.__radix_point = __result.__last;
- __result.__exponent = __result.__last;
- } else {
- __result.__exponent = __formatter::__find_exponent(__first, __result.__last);
- if (__result.__exponent != __result.__last)
- // In scientific mode if there's a radix point it will always be after
- // the first digit. (This is the position __first points at).
- __result.__radix_point = *__first == '.' ? __first : __result.__last;
- else {
- // In fixed mode the algorithm truncates trailing spaces and possibly the
- // radix point. There's no good guess for the position of the radix point
- // therefore scan the output after the first digit.
- __result.__radix_point = std::find(__first, __result.__last, '.');
- }
- }
-
- // clang-format off
- _LIBCPP_ASSERT_INTERNAL((__result.__integral != __result.__last) &&
- (__result.__radix_point == __result.__last || *__result.__radix_point == '.') &&
- (__result.__exponent == __result.__last || *__result.__exponent == 'e'),
- "Post-condition failure.");
- // clang-format on
-
- return __result;
-}
-
-template <class _Fp, class _Tp>
-_LIBCPP_HIDE_FROM_ABI __float_result
-__format_buffer_general_upper_case(__float_buffer<_Fp>& __buffer, _Tp __value, int __precision, char* __integral) {
- __float_result __result = __formatter::__format_buffer_general_lower_case(__buffer, __value, __precision, __integral);
- if (__result.__exponent != __result.__last)
- *__result.__exponent = 'E';
- return __result;
-}
-
-/// Fills the buffer with the data based on the requested formatting.
-///
-/// This function, when needed, turns the characters to upper case and
-/// determines the "interesting" locations which are returned to the caller.
-///
-/// This means the caller never has to convert the contents of the buffer to
-/// upper case or search for radix points and the location of the exponent.
-/// This gives a bit of overhead. The original code didn't do that, but due
-/// to the number of possible additional work needed to turn this number to
-/// the proper output the code was littered with tests for upper cases and
-/// searches for radix points and exponents.
-/// - When a precision larger than the type's precision is selected
-/// additional zero characters need to be written before the exponent.
-/// - alternate form needs to add a radix point when not present.
-/// - localization needs to do grouping in the integral part.
-template <class _Fp, class _Tp>
-// TODO FMT _Fp should just be _Tp when to_chars has proper long double support.
-_LIBCPP_HIDE_FROM_ABI __float_result __format_buffer(
- __float_buffer<_Fp>& __buffer,
- _Tp __value,
- bool __negative,
- bool __has_precision,
- __format_spec::__sign __sign,
- __format_spec::__type __type) {
- char* __first = __formatter::__insert_sign(__buffer.begin(), __negative, __sign);
- switch (__type) {
- case __format_spec::__type::__default:
- if (__has_precision)
- return __formatter::__format_buffer_general_lower_case(__buffer, __value, __buffer.__precision(), __first);
- else
- return __formatter::__format_buffer_default(__buffer, __value, __first);
-
- case __format_spec::__type::__hexfloat_lower_case:
- return __formatter::__format_buffer_hexadecimal_lower_case(
- __buffer, __value, __has_precision ? __buffer.__precision() : -1, __first);
-
- case __format_spec::__type::__hexfloat_upper_case:
- return __formatter::__format_buffer_hexadecimal_upper_case(
- __buffer, __value, __has_precision ? __buffer.__precision() : -1, __first);
-
- case __format_spec::__type::__scientific_lower_case:
- return __formatter::__format_buffer_scientific_lower_case(__buffer, __value, __buffer.__precision(), __first);
-
- case __format_spec::__type::__scientific_upper_case:
- return __formatter::__format_buffer_scientific_upper_case(__buffer, __value, __buffer.__precision(), __first);
-
- case __format_spec::__type::__fixed_lower_case:
- case __format_spec::__type::__fixed_upper_case:
- return __formatter::__format_buffer_fixed(__buffer, __value, __buffer.__precision(), __first);
-
- case __format_spec::__type::__general_lower_case:
- return __formatter::__format_buffer_general_lower_case(__buffer, __value, __buffer.__precision(), __first);
-
- case __format_spec::__type::__general_upper_case:
- return __formatter::__format_buffer_general_upper_case(__buffer, __value, __buffer.__precision(), __first);
-
- default:
- _LIBCPP_ASSERT_INTERNAL(false, "The parser should have validated the type");
- __libcpp_unreachable();
- }
-}
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
-template <class _OutIt, class _Fp, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutIt __format_locale_specific_form(
- _OutIt __out_it,
- const __float_buffer<_Fp>& __buffer,
- const __float_result& __result,
- std::locale __loc,
- __format_spec::__parsed_specifications<_CharT> __specs) {
- const auto& __np = std::use_facet<numpunct<_CharT>>(__loc);
- string __grouping = __np.grouping();
- char* __first = __result.__integral;
- // When no radix point or exponent are present __last will be __result.__last.
- char* __last = std::min(__result.__radix_point, __result.__exponent);
-
- ptrdiff_t __digits = __last - __first;
- if (!__grouping.empty()) {
- if (__digits <= __grouping[0])
- __grouping.clear();
- else
- __grouping = __formatter::__determine_grouping(__digits, __grouping);
- }
-
- ptrdiff_t __size =
- __result.__last - __buffer.begin() + // Formatted string
- __buffer.__num_trailing_zeros() + // Not yet rendered zeros
- __grouping.size() - // Grouping contains one
- !__grouping.empty(); // additional character
-
- __formatter::__padding_size_result __padding = {0, 0};
- bool __zero_padding = __specs.__alignment_ == __format_spec::__alignment::__zero_padding;
- if (__size < __specs.__width_) {
- if (__zero_padding) {
- __specs.__alignment_ = __format_spec::__alignment::__right;
- __specs.__fill_.__data[0] = _CharT('0');
- }
-
- __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
- }
-
- // sign and (zero padding or alignment)
- if (__zero_padding && __first != __buffer.begin())
- *__out_it++ = *__buffer.begin();
- __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
- if (!__zero_padding && __first != __buffer.begin())
- *__out_it++ = *__buffer.begin();
-
- // integral part
- if (__grouping.empty()) {
- __out_it = __formatter::__copy(__first, __digits, std::move(__out_it));
- } else {
- auto __r = __grouping.rbegin();
- auto __e = __grouping.rend() - 1;
- _CharT __sep = __np.thousands_sep();
- // The output is divided in small groups of numbers to write:
- // - A group before the first separator.
- // - A separator and a group, repeated for the number of separators.
- // - A group after the last separator.
- // This loop achieves that process by testing the termination condition
- // midway in the loop.
- while (true) {
- __out_it = __formatter::__copy(__first, *__r, std::move(__out_it));
- __first += *__r;
-
- if (__r == __e)
- break;
-
- ++__r;
- *__out_it++ = __sep;
- }
- }
-
- // fractional part
- if (__result.__radix_point != __result.__last) {
- *__out_it++ = __np.decimal_point();
- __out_it = __formatter::__copy(__result.__radix_point + 1, __result.__exponent, std::move(__out_it));
- __out_it = __formatter::__fill(std::move(__out_it), __buffer.__num_trailing_zeros(), _CharT('0'));
- }
-
- // exponent
- if (__result.__exponent != __result.__last)
- __out_it = __formatter::__copy(__result.__exponent, __result.__last, std::move(__out_it));
-
- // alignment
- return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
-}
-# endif // _LIBCPP_HAS_NO_LOCALIZATION
-
-template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI _OutIt __format_floating_point_non_finite(
- _OutIt __out_it, __format_spec::__parsed_specifications<_CharT> __specs, bool __negative, bool __isnan) {
- char __buffer[4];
- char* __last = __formatter::__insert_sign(__buffer, __negative, __specs.__std_.__sign_);
-
- // to_chars can return inf, infinity, nan, and nan(n-char-sequence).
- // The format library requires inf and nan.
- // All in one expression to avoid dangling references.
- bool __upper_case =
- __specs.__std_.__type_ == __format_spec::__type::__hexfloat_upper_case ||
- __specs.__std_.__type_ == __format_spec::__type::__scientific_upper_case ||
- __specs.__std_.__type_ == __format_spec::__type::__fixed_upper_case ||
- __specs.__std_.__type_ == __format_spec::__type::__general_upper_case;
- __last = std::copy_n(&("infnanINFNAN"[6 * __upper_case + 3 * __isnan]), 3, __last);
-
- // [format.string.std]/13
- // A zero (0) character preceding the width field pads the field with
- // leading zeros (following any indication of sign or base) to the field
- // width, except when applied to an infinity or NaN.
- if (__specs.__alignment_ == __format_spec::__alignment::__zero_padding)
- __specs.__alignment_ = __format_spec::__alignment::__right;
-
- return __formatter::__write(__buffer, __last, std::move(__out_it), __specs);
-}
-
-/// Writes additional zero's for the precision before the exponent.
-/// This is used when the precision requested in the format string is larger
-/// than the maximum precision of the floating-point type. These precision
-/// digits are always 0.
-///
-/// \param __exponent The location of the exponent character.
-/// \param __num_trailing_zeros The number of 0's to write before the exponent
-/// character.
-template <class _CharT, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
- const _CharT* __first,
- const _CharT* __last,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- size_t __size,
- const _CharT* __exponent,
- size_t __num_trailing_zeros) -> decltype(__out_it) {
- _LIBCPP_ASSERT_INTERNAL(__first <= __last, "Not a valid range");
- _LIBCPP_ASSERT_INTERNAL(__num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used");
-
- __padding_size_result __padding =
- __formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_);
- __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
- __out_it = __formatter::__copy(__first, __exponent, std::move(__out_it));
- __out_it = __formatter::__fill(std::move(__out_it), __num_trailing_zeros, _CharT('0'));
- __out_it = __formatter::__copy(__exponent, __last, std::move(__out_it));
- return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
-}
-
-template <floating_point _Tp, class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
-__format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
- bool __negative = std::signbit(__value);
-
- if (!std::isfinite(__value)) [[unlikely]]
- return __formatter::__format_floating_point_non_finite(__ctx.out(), __specs, __negative, std::isnan(__value));
-
- // Depending on the std-format-spec string the sign and the value
- // might not be outputted together:
- // - zero-padding may insert additional '0' characters.
- // Therefore the value is processed as a non negative value.
- // The function @ref __insert_sign will insert a '-' when the value was
- // negative.
-
- if (__negative)
- __value = -__value;
-
- // TODO FMT _Fp should just be _Tp when to_chars has proper long double support.
- using _Fp = conditional_t<same_as<_Tp, long double>, double, _Tp>;
- // Force the type of the precision to avoid -1 to become an unsigned value.
- __float_buffer<_Fp> __buffer(__specs.__precision_);
- __float_result __result = __formatter::__format_buffer(
- __buffer, __value, __negative, (__specs.__has_precision()), __specs.__std_.__sign_, __specs.__std_.__type_);
-
- if (__specs.__std_.__alternate_form_) {
- if (__result.__radix_point == __result.__last) {
- *__result.__last++ = '.';
-
- // When there is an exponent the point needs to be moved before the
- // exponent. When there's no exponent the rotate does nothing. Since
- // rotate tests whether the operation is a nop, call it unconditionally.
- std::rotate(__result.__exponent, __result.__last - 1, __result.__last);
- __result.__radix_point = __result.__exponent;
-
- // The radix point is always placed before the exponent.
- // - No exponent needs to point to the new last.
- // - An exponent needs to move one position to the right.
- // So it's safe to increment the value unconditionally.
- ++__result.__exponent;
- }
-
- // [format.string.std]/6
- // In addition, for g and G conversions, trailing zeros are not removed
- // from the result.
- //
- // If the type option for a floating-point type is none it may use the
- // general formatting, but it's not a g or G conversion. So in that case
- // the formatting should not append trailing zeros.
- bool __is_general = __specs.__std_.__type_ == __format_spec::__type::__general_lower_case ||
- __specs.__std_.__type_ == __format_spec::__type::__general_upper_case;
-
- if (__is_general) {
- // https://en.cppreference.com/w/c/io/fprintf
- // Let P equal the precision if nonzero, 6 if the precision is not
- // specified, or 1 if the precision is 0. Then, if a conversion with
- // style E would have an exponent of X:
- int __p = std::max<int>(1, (__specs.__has_precision() ? __specs.__precision_ : 6));
- if (__result.__exponent == __result.__last)
- // if P > X >= -4, the conversion is with style f or F and precision P - 1 - X.
- // By including the radix point it calculates P - (1 + X)
- __p -= __result.__radix_point - __result.__integral;
- else
- // otherwise, the conversion is with style e or E and precision P - 1.
- --__p;
-
- ptrdiff_t __precision = (__result.__exponent - __result.__radix_point) - 1;
- if (__precision < __p)
- __buffer.__add_trailing_zeros(__p - __precision);
- }
- }
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- if (__specs.__std_.__locale_specific_form_)
- return __formatter::__format_locale_specific_form(__ctx.out(), __buffer, __result, __ctx.locale(), __specs);
-# endif
-
- ptrdiff_t __size = __result.__last - __buffer.begin();
- int __num_trailing_zeros = __buffer.__num_trailing_zeros();
- if (__size + __num_trailing_zeros >= __specs.__width_) {
- if (__num_trailing_zeros && __result.__exponent != __result.__last)
- // Insert trailing zeros before exponent character.
- return __formatter::__copy(
- __result.__exponent,
- __result.__last,
- __formatter::__fill(__formatter::__copy(__buffer.begin(), __result.__exponent, __ctx.out()),
- __num_trailing_zeros,
- _CharT('0')));
-
- return __formatter::__fill(
- __formatter::__copy(__buffer.begin(), __result.__last, __ctx.out()), __num_trailing_zeros, _CharT('0'));
- }
-
- auto __out_it = __ctx.out();
- char* __first = __buffer.begin();
- if (__specs.__alignment_ == __format_spec::__alignment ::__zero_padding) {
- // When there is a sign output it before the padding. Note the __size
- // doesn't need any adjustment, regardless whether the sign is written
- // here or in __formatter::__write.
- if (__first != __result.__integral)
- *__out_it++ = *__first++;
- // After the sign is written, zero padding is the same a right alignment
- // with '0'.
- __specs.__alignment_ = __format_spec::__alignment::__right;
- __specs.__fill_.__data[0] = _CharT('0');
- }
-
- if (__num_trailing_zeros)
- return __formatter::__write_using_trailing_zeros(
- __first, __result.__last, std::move(__out_it), __specs, __size, __result.__exponent, __num_trailing_zeros);
-
- return __formatter::__write(__first, __result.__last, std::move(__out_it), __specs, __size);
-}
-
-} // namespace __formatter
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_floating_point {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_floating_point);
- __format_spec::__process_parsed_floating_point(__parser_, "a floating-point");
- return __result;
- }
-
- template <floating_point _Tp, class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_Tp __value, _FormatContext& __ctx) const {
- return __formatter::__format_floating_point(__value, __ctx, __parser_.__get_parsed_std_specifications(__ctx));
- }
-
- __format_spec::__parser<_CharT> __parser_;
-};
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT> : public __formatter_floating_point<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT> : public __formatter_floating_point<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT> : public __formatter_floating_point<_CharT> {};
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_FLOATING_POINT_H
diff --git a/libcxx/include/__cxx03/__format/formatter_integer.h b/libcxx/include/__cxx03/__format/formatter_integer.h
deleted file mode 100644
index 365b44093ede2..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_integer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_INTEGER_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_INTEGER_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/make_32_64_or_128_bit.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_integer {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral);
- __format_spec::__process_parsed_integer(__parser_, "an integer");
- return __result;
- }
-
- template <integral _Tp, class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_Tp __value, _FormatContext& __ctx) const {
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
-
- if (__specs.__std_.__type_ == __format_spec::__type::__char)
- return __formatter::__format_char(__value, __ctx.out(), __specs);
-
- using _Type = __make_32_64_or_128_bit_t<_Tp>;
- static_assert(!is_void<_Type>::value, "unsupported integral type used in __formatter_integer::__format");
-
- // Reduce the number of instantiation of the integer formatter
- return __formatter::__format_integer(static_cast<_Type>(__value), __ctx, __specs);
- }
-
- __format_spec::__parser<_CharT> __parser_;
-};
-
-// Signed integral types.
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<int, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT> : public __formatter_integer<_CharT> {};
-# ifndef _LIBCPP_HAS_NO_INT128
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT> : public __formatter_integer<_CharT> {};
-# endif
-
-// Unsigned integral types.
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT> : public __formatter_integer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT> : public __formatter_integer<_CharT> {};
-# ifndef _LIBCPP_HAS_NO_INT128
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {};
-# endif
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_INTEGER_H
diff --git a/libcxx/include/__cxx03/__format/formatter_integral.h b/libcxx/include/__cxx03/__format/formatter_integral.h
deleted file mode 100644
index fc846549dabdc..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_integral.h
+++ /dev/null
@@ -1,445 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_INTEGRAL_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_INTEGRAL_H
-
-#include <__cxx03/__charconv/to_chars_integral.h>
-#include <__cxx03/__charconv/to_chars_result.h>
-#include <__cxx03/__charconv/traits.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/array>
-#include <__cxx03/limits>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <__cxx03/__locale>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __formatter {
-
-//
-// Generic
-//
-
-template <contiguous_iterator _Iterator>
- requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI inline _Iterator __insert_sign(_Iterator __buf, bool __negative, __format_spec::__sign __sign) {
- if (__negative)
- *__buf++ = '-';
- else
- switch (__sign) {
- case __format_spec::__sign::__default:
- case __format_spec::__sign::__minus:
- // No sign added.
- break;
- case __format_spec::__sign::__plus:
- *__buf++ = '+';
- break;
- case __format_spec::__sign::__space:
- *__buf++ = ' ';
- break;
- }
-
- return __buf;
-}
-
-/**
- * Determines the required grouping based on the size of the input.
- *
- * The grouping's last element will be repeated. For simplicity this repeating
- * is unwrapped based on the length of the input. (When the input is short some
- * groups are not processed.)
- *
- * @returns The size of the groups to write. This means the number of
- * separator characters written is size() - 1.
- *
- * @note Since zero-sized groups cause issues they are silently ignored.
- *
- * @note The grouping field of the locale is always a @c std::string,
- * regardless whether the @c std::numpunct's type is @c char or @c wchar_t.
- */
-_LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const string& __grouping) {
- _LIBCPP_ASSERT_INTERNAL(!__grouping.empty() && __size > __grouping[0],
- "The slow grouping formatting is used while there will be no separators written");
- string __r;
- auto __end = __grouping.end() - 1;
- auto __ptr = __grouping.begin();
-
- while (true) {
- __size -= *__ptr;
- if (__size > 0)
- __r.push_back(*__ptr);
- else {
- // __size <= 0 so the value pushed will be <= *__ptr.
- __r.push_back(*__ptr + __size);
- return __r;
- }
-
- // Proceed to the next group.
- if (__ptr != __end) {
- do {
- ++__ptr;
- // Skip grouping with a width of 0.
- } while (*__ptr == 0 && __ptr != __end);
- }
- }
-
- __libcpp_unreachable();
-}
-
-//
-// Char
-//
-
-template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__format_char(integral auto __value,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
- using _Tp = decltype(__value);
- if constexpr (!same_as<_CharT, _Tp>) {
- // cmp_less and cmp_greater can't be used for character types.
- if constexpr (signed_integral<_CharT> == signed_integral<_Tp>) {
- if (__value < numeric_limits<_CharT>::min() || __value > numeric_limits<_CharT>::max())
- std::__throw_format_error("Integral value outside the range of the char type");
- } else if constexpr (signed_integral<_CharT>) {
- // _CharT is signed _Tp is unsigned
- if (__value > static_cast<make_unsigned_t<_CharT>>(numeric_limits<_CharT>::max()))
- std::__throw_format_error("Integral value outside the range of the char type");
- } else {
- // _CharT is unsigned _Tp is signed
- if (__value < 0 || static_cast<make_unsigned_t<_Tp>>(__value) > numeric_limits<_CharT>::max())
- std::__throw_format_error("Integral value outside the range of the char type");
- }
- }
-
- const auto __c = static_cast<_CharT>(__value);
- return __formatter::__write(std::addressof(__c), std::addressof(__c) + 1, std::move(__out_it), __specs);
-}
-
-//
-// Integer
-//
-
-/** Wrapper around @ref to_chars, returning the output iterator. */
-template <contiguous_iterator _Iterator, integral _Tp>
- requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI _Iterator __to_buffer(_Iterator __first, _Iterator __last, _Tp __value, int __base) {
- // TODO FMT Evaluate code overhead due to not calling the internal function
- // directly. (Should be zero overhead.)
- to_chars_result __r = std::to_chars(std::to_address(__first), std::to_address(__last), __value, __base);
- _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small");
- auto __diff = __r.ptr - std::to_address(__first);
- return __first + __diff;
-}
-
-/**
- * Helper to determine the buffer size to output a integer in Base @em x.
- *
- * There are several overloads for the supported bases. The function uses the
- * base as template argument so it can be used in a constant expression.
- */
-template <unsigned_integral _Tp, size_t _Base>
-consteval size_t __buffer_size() noexcept
- requires(_Base == 2)
-{
- return numeric_limits<_Tp>::digits // The number of binary digits.
- + 2 // Reserve space for the '0[Bb]' prefix.
- + 1; // Reserve space for the sign.
-}
-
-template <unsigned_integral _Tp, size_t _Base>
-consteval size_t __buffer_size() noexcept
- requires(_Base == 8)
-{
- return numeric_limits<_Tp>::digits // The number of binary digits.
- / 3 // Adjust to octal.
- + 1 // Turn floor to ceil.
- + 1 // Reserve space for the '0' prefix.
- + 1; // Reserve space for the sign.
-}
-
-template <unsigned_integral _Tp, size_t _Base>
-consteval size_t __buffer_size() noexcept
- requires(_Base == 10)
-{
- return numeric_limits<_Tp>::digits10 // The floored value.
- + 1 // Turn floor to ceil.
- + 1; // Reserve space for the sign.
-}
-
-template <unsigned_integral _Tp, size_t _Base>
-consteval size_t __buffer_size() noexcept
- requires(_Base == 16)
-{
- return numeric_limits<_Tp>::digits // The number of binary digits.
- / 4 // Adjust to hexadecimal.
- + 2 // Reserve space for the '0[Xx]' prefix.
- + 1; // Reserve space for the sign.
-}
-
-template <class _OutIt, contiguous_iterator _Iterator, class _CharT>
- requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
- _OutIt __out_it,
- _Iterator __begin,
- _Iterator __first,
- _Iterator __last,
- string&& __grouping,
- _CharT __sep,
- __format_spec::__parsed_specifications<_CharT> __specs) {
- int __size = (__first - __begin) + // [sign][prefix]
- (__last - __first) + // data
- (__grouping.size() - 1); // number of separator characters
-
- __padding_size_result __padding = {0, 0};
- if (__specs.__alignment_ == __format_spec::__alignment::__zero_padding) {
- // Write [sign][prefix].
- __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
-
- if (__specs.__width_ > __size) {
- // Write zero padding.
- __padding.__before_ = __specs.__width_ - __size;
- __out_it = __formatter::__fill(std::move(__out_it), __specs.__width_ - __size, _CharT('0'));
- }
- } else {
- if (__specs.__width_ > __size) {
- // Determine padding and write padding.
- __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
-
- __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
- }
- // Write [sign][prefix].
- __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
- }
-
- auto __r = __grouping.rbegin();
- auto __e = __grouping.rend() - 1;
- _LIBCPP_ASSERT_INTERNAL(
- __r != __e, "The slow grouping formatting is used while there will be no separators written.");
- // The output is divided in small groups of numbers to write:
- // - A group before the first separator.
- // - A separator and a group, repeated for the number of separators.
- // - A group after the last separator.
- // This loop achieves that process by testing the termination condition
- // midway in the loop.
- //
- // TODO FMT This loop evaluates the loop invariant `__parser.__type !=
- // _Flags::_Type::__hexadecimal_upper_case` for every iteration. (This test
- // happens in the __write call.) Benchmark whether making two loops and
- // hoisting the invariant is worth the effort.
- while (true) {
- if (__specs.__std_.__type_ == __format_spec::__type::__hexadecimal_upper_case) {
- __last = __first + *__r;
- __out_it = __formatter::__transform(__first, __last, std::move(__out_it), __hex_to_upper);
- __first = __last;
- } else {
- __out_it = __formatter::__copy(__first, *__r, std::move(__out_it));
- __first += *__r;
- }
-
- if (__r == __e)
- break;
-
- ++__r;
- *__out_it++ = __sep;
- }
-
- return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
-}
-
-template <unsigned_integral _Tp, contiguous_iterator _Iterator, class _CharT, class _FormatContext>
- requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
- _Tp __value,
- _FormatContext& __ctx,
- __format_spec::__parsed_specifications<_CharT> __specs,
- bool __negative,
- _Iterator __begin,
- _Iterator __end,
- const char* __prefix,
- int __base) {
- _Iterator __first = __formatter::__insert_sign(__begin, __negative, __specs.__std_.__sign_);
- if (__specs.__std_.__alternate_form_ && __prefix)
- while (*__prefix)
- *__first++ = *__prefix++;
-
- _Iterator __last = __formatter::__to_buffer(__first, __end, __value, __base);
-
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- if (__specs.__std_.__locale_specific_form_) {
- const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale());
- string __grouping = __np.grouping();
- ptrdiff_t __size = __last - __first;
- // Writing the grouped form has more overhead than the normal output
- // routines. If there will be no separators written the locale-specific
- // form is identical to the normal routine. Test whether to grouped form
- // is required.
- if (!__grouping.empty() && __size > __grouping[0])
- return __formatter::__write_using_decimal_separators(
- __ctx.out(),
- __begin,
- __first,
- __last,
- __formatter::__determine_grouping(__size, __grouping),
- __np.thousands_sep(),
- __specs);
- }
-# endif
- auto __out_it = __ctx.out();
- if (__specs.__alignment_ != __format_spec::__alignment::__zero_padding)
- __first = __begin;
- else {
- // __buf contains [sign][prefix]data
- // ^ location of __first
- // The zero padding is done like:
- // - Write [sign][prefix]
- // - Write data right aligned with '0' as fill character.
- __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
- __specs.__alignment_ = __format_spec::__alignment::__right;
- __specs.__fill_.__data[0] = _CharT('0');
- int32_t __size = __first - __begin;
-
- __specs.__width_ -= std::min(__size, __specs.__width_);
- }
-
- if (__specs.__std_.__type_ != __format_spec::__type::__hexadecimal_upper_case) [[likely]]
- return __formatter::__write(__first, __last, __ctx.out(), __specs);
-
- return __formatter::__write_transformed(__first, __last, __ctx.out(), __specs, __formatter::__hex_to_upper);
-}
-
-template <unsigned_integral _Tp, class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
-__format_integer(_Tp __value,
- _FormatContext& __ctx,
- __format_spec::__parsed_specifications<_CharT> __specs,
- bool __negative = false) {
- switch (__specs.__std_.__type_) {
- case __format_spec::__type::__binary_lower_case: {
- array<char, __formatter::__buffer_size<decltype(__value), 2>()> __array;
- return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0b", 2);
- }
- case __format_spec::__type::__binary_upper_case: {
- array<char, __formatter::__buffer_size<decltype(__value), 2>()> __array;
- return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0B", 2);
- }
- case __format_spec::__type::__octal: {
- // Octal is special; if __value == 0 there's no prefix.
- array<char, __formatter::__buffer_size<decltype(__value), 8>()> __array;
- return __formatter::__format_integer(
- __value, __ctx, __specs, __negative, __array.begin(), __array.end(), __value != 0 ? "0" : nullptr, 8);
- }
- case __format_spec::__type::__default:
- case __format_spec::__type::__decimal: {
- array<char, __formatter::__buffer_size<decltype(__value), 10>()> __array;
- return __formatter::__format_integer(
- __value, __ctx, __specs, __negative, __array.begin(), __array.end(), nullptr, 10);
- }
- case __format_spec::__type::__hexadecimal_lower_case: {
- array<char, __formatter::__buffer_size<decltype(__value), 16>()> __array;
- return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0x", 16);
- }
- case __format_spec::__type::__hexadecimal_upper_case: {
- array<char, __formatter::__buffer_size<decltype(__value), 16>()> __array;
- return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0X", 16);
- }
- default:
- _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type");
- __libcpp_unreachable();
- }
-}
-
-template <signed_integral _Tp, class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
-__format_integer(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
- // Depending on the std-format-spec string the sign and the value
- // might not be outputted together:
- // - alternate form may insert a prefix string.
- // - zero-padding may insert additional '0' characters.
- // Therefore the value is processed as a positive unsigned value.
- // The function @ref __insert_sign will a '-' when the value was negative.
- auto __r = std::__to_unsigned_like(__value);
- bool __negative = __value < 0;
- if (__negative)
- __r = std::__complement(__r);
-
- return __formatter::__format_integer(__r, __ctx, __specs, __negative);
-}
-
-//
-// Formatter arithmetic (bool)
-//
-
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __bool_strings;
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS __bool_strings<char> {
- static constexpr string_view __true{"true"};
- static constexpr string_view __false{"false"};
-};
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <>
-struct _LIBCPP_TEMPLATE_VIS __bool_strings<wchar_t> {
- static constexpr wstring_view __true{L"true"};
- static constexpr wstring_view __false{L"false"};
-};
-# endif
-
-template <class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
-__format_bool(bool __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
-# ifndef _LIBCPP_HAS_NO_LOCALIZATION
- if (__specs.__std_.__locale_specific_form_) {
- const auto& __np = std::use_facet<numpunct<_CharT>>(__ctx.locale());
- basic_string<_CharT> __str = __value ? __np.truename() : __np.falsename();
- return __formatter::__write_string_no_precision(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
- }
-# endif
- basic_string_view<_CharT> __str =
- __value ? __formatter::__bool_strings<_CharT>::__true : __formatter::__bool_strings<_CharT>::__false;
- return __formatter::__write(__str.begin(), __str.end(), __ctx.out(), __specs);
-}
-
-} // namespace __formatter
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_INTEGRAL_H
diff --git a/libcxx/include/__cxx03/__format/formatter_output.h b/libcxx/include/__cxx03/__format/formatter_output.h
deleted file mode 100644
index 1f3ab7f2ff692..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_output.h
+++ /dev/null
@@ -1,335 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_OUTPUT_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_OUTPUT_H
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__algorithm/ranges_fill_n.h>
-#include <__cxx03/__algorithm/ranges_transform.h>
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/buffer.h>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__format/unicode.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __formatter {
-
-_LIBCPP_HIDE_FROM_ABI constexpr char __hex_to_upper(char __c) {
- switch (__c) {
- case 'a':
- return 'A';
- case 'b':
- return 'B';
- case 'c':
- return 'C';
- case 'd':
- return 'D';
- case 'e':
- return 'E';
- case 'f':
- return 'F';
- }
- return __c;
-}
-
-struct _LIBCPP_EXPORTED_FROM_ABI __padding_size_result {
- size_t __before_;
- size_t __after_;
-};
-
-_LIBCPP_HIDE_FROM_ABI constexpr __padding_size_result
-__padding_size(size_t __size, size_t __width, __format_spec::__alignment __align) {
- _LIBCPP_ASSERT_INTERNAL(__width > __size, "don't call this function when no padding is required");
- _LIBCPP_ASSERT_INTERNAL(
- __align != __format_spec::__alignment::__zero_padding, "the caller should have handled the zero-padding");
-
- size_t __fill = __width - __size;
- switch (__align) {
- case __format_spec::__alignment::__zero_padding:
- __libcpp_unreachable();
-
- case __format_spec::__alignment::__left:
- return {0, __fill};
-
- case __format_spec::__alignment::__center: {
- // The extra padding is divided per [format.string.std]/3
- // __before = floor(__fill, 2);
- // __after = ceil(__fill, 2);
- size_t __before = __fill / 2;
- size_t __after = __fill - __before;
- return {__before, __after};
- }
- case __format_spec::__alignment::__default:
- case __format_spec::__alignment::__right:
- return {__fill, 0};
- }
- __libcpp_unreachable();
-}
-
-/// Copy wrapper.
-///
-/// This uses a "mass output function" of __format::__output_buffer when possible.
-template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
- if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
- __out_it.__get_container()->__copy(__str);
- return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
- __out_it.__buffer_->__copy(__str);
- return __out_it;
- } else {
- return std::ranges::copy(__str, std::move(__out_it)).out;
- }
-}
-
-template <contiguous_iterator _Iterator,
- __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
- __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
- return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
-}
-
-template <contiguous_iterator _Iterator,
- __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
- __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
- return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
-}
-
-/// Transform wrapper.
-///
-/// This uses a "mass output function" of __format::__output_buffer when possible.
-template <contiguous_iterator _Iterator,
- __fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
- __fmt_char_type _OutCharT = _CharT,
- class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
-__transform(_Iterator __first,
- _Iterator __last,
- output_iterator<const _OutCharT&> auto __out_it,
- _UnaryOperation __operation) -> decltype(__out_it) {
- if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
- __out_it.__get_container()->__transform(__first, __last, std::move(__operation));
- return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_OutCharT>::__iterator>) {
- __out_it.__buffer_->__transform(__first, __last, std::move(__operation));
- return __out_it;
- } else {
- return std::ranges::transform(__first, __last, std::move(__out_it), __operation).out;
- }
-}
-
-/// Fill wrapper.
-///
-/// This uses a "mass output function" of __format::__output_buffer when possible.
-template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value) {
- if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_CharT>>>) {
- __out_it.__get_container()->__fill(__n, __value);
- return __out_it;
- } else if constexpr (std::same_as<decltype(__out_it), typename __format::__retarget_buffer<_CharT>::__iterator>) {
- __out_it.__buffer_->__fill(__n, __value);
- return __out_it;
- } else {
- return std::ranges::fill_n(std::move(__out_it), __n, __value);
- }
-}
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
- requires(same_as<_CharT, char>)
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
- std::size_t __bytes = std::countl_one(static_cast<unsigned char>(__value.__data[0]));
- if (__bytes == 0)
- return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
-
- for (size_t __i = 0; __i < __n; ++__i)
- __out_it = __formatter::__copy(
- std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + __bytes, std::move(__out_it));
- return __out_it;
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
- requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
- if (!__unicode::__is_high_surrogate(__value.__data[0]))
- return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
-
- for (size_t __i = 0; __i < __n; ++__i)
- __out_it = __formatter::__copy(
- std::addressof(__value.__data[0]), std::addressof(__value.__data[0]) + 2, std::move(__out_it));
- return __out_it;
-}
-
-template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
- requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
- return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
-}
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# else // _LIBCPP_HAS_NO_UNICODE
-template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
- return __formatter::__fill(std::move(__out_it), __n, __value.__data[0]);
-}
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-/// Writes the input to the output with the required padding.
-///
-/// Since the output column width is specified the function can be used for
-/// ASCII and Unicode output.
-///
-/// \pre \a __size <= \a __width. Using this function when this pre-condition
-/// doesn't hold incurs an unwanted overhead.
-///
-/// \param __str The string to write.
-/// \param __out_it The output iterator to write to.
-/// \param __specs The parsed formatting specifications.
-/// \param __size The (estimated) output column width. When the elements
-/// to be written are ASCII the following condition holds
-/// \a __size == \a __last - \a __first.
-///
-/// \returns An iterator pointing beyond the last element written.
-///
-/// \note The type of the elements in range [\a __first, \a __last) can differ
-/// from the type of \a __specs. Integer output uses \c std::to_chars for its
-/// conversion, which means the [\a __first, \a __last) always contains elements
-/// of the type \c char.
-template <class _CharT, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__write(basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- ptrdiff_t __size) -> decltype(__out_it) {
- if (__size >= __specs.__width_)
- return __formatter::__copy(__str, std::move(__out_it));
-
- __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__std_.__alignment_);
- __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
- __out_it = __formatter::__copy(__str, std::move(__out_it));
- return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
-}
-
-template <contiguous_iterator _Iterator, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__write(_Iterator __first,
- _Iterator __last,
- output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- ptrdiff_t __size) -> decltype(__out_it) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
- return __formatter::__write(basic_string_view{__first, __last}, std::move(__out_it), __specs, __size);
-}
-
-/// \overload
-///
-/// Calls the function above where \a __size = \a __last - \a __first.
-template <contiguous_iterator _Iterator, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__write(_Iterator __first,
- _Iterator __last,
- output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
- return __formatter::__write(__first, __last, std::move(__out_it), __specs, __last - __first);
-}
-
-template <contiguous_iterator _Iterator,
- class _CharT = typename iterator_traits<_Iterator>::value_type,
- class _ParserCharT,
- class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __write_transformed(
- _Iterator __first,
- _Iterator __last,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_ParserCharT> __specs,
- _UnaryOperation __op) -> decltype(__out_it) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "Not a valid range");
-
- ptrdiff_t __size = __last - __first;
- if (__size >= __specs.__width_)
- return __formatter::__transform(__first, __last, std::move(__out_it), __op);
-
- __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
- __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
- __out_it = __formatter::__transform(__first, __last, std::move(__out_it), __op);
- return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
-}
-
-/// Writes a string using format's width estimation algorithm.
-///
-/// \pre !__specs.__has_precision()
-///
-/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
-/// input is ASCII.
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
- basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
- _LIBCPP_ASSERT_INTERNAL(!__specs.__has_precision(), "use __write_string");
-
- // No padding -> copy the string
- if (!__specs.__has_width())
- return __formatter::__copy(__str, std::move(__out_it));
-
- // Note when the estimated width is larger than size there's no padding. So
- // there's no reason to get the real size when the estimate is larger than or
- // equal to the minimum field width.
- size_t __size =
- __format_spec::__estimate_column_width(__str, __specs.__width_, __format_spec::__column_width_rounding::__up)
- .__width_;
- return __formatter::__write(__str, std::move(__out_it), __specs, __size);
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision) {
- __format_spec::__column_width_result __result =
- __format_spec::__estimate_column_width(__str, __precision, __format_spec::__column_width_rounding::__down);
- __str = basic_string_view<_CharT>{__str.begin(), __result.__last_};
- return __result.__width_;
-}
-
-} // namespace __formatter
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_OUTPUT_H
diff --git a/libcxx/include/__cxx03/__format/formatter_pointer.h b/libcxx/include/__cxx03/__format/formatter_pointer.h
deleted file mode 100644
index 906d62a83e33b..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_pointer.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_POINTER_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_POINTER_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_pointer {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_pointer);
- __format_spec::__process_display_type_pointer(__parser_.__type_, "a pointer");
- return __result;
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const void* __ptr, _FormatContext& __ctx) const {
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
- __specs.__std_.__alternate_form_ = true;
- __specs.__std_.__type_ =
- __specs.__std_.__type_ == __format_spec::__type::__pointer_upper_case
- ? __format_spec::__type::__hexadecimal_upper_case
- : __format_spec::__type::__hexadecimal_lower_case;
-
- return __formatter::__format_integer(reinterpret_cast<uintptr_t>(__ptr), __ctx, __specs);
- }
-
- __format_spec::__parser<_CharT> __parser_;
-};
-
-// [format.formatter.spec]/2.4
-// For each charT, the pointer type specializations template<>
-// - struct formatter<nullptr_t, charT>;
-// - template<> struct formatter<void*, charT>;
-// - template<> struct formatter<const void*, charT>;
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT> : public __formatter_pointer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> {};
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT> : public __formatter_pointer<_CharT> {};
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_POINTER_H
diff --git a/libcxx/include/__cxx03/__format/formatter_string.h b/libcxx/include/__cxx03/__format/formatter_string.h
deleted file mode 100644
index 024f7936875ec..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_string.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_STRING_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_STRING_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__format/write_escaped.h>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS __formatter_string {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_string);
- __format_spec::__process_display_type_string(__parser_.__type_);
- return __result;
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(basic_string_view<_CharT> __str, _FormatContext& __ctx) const {
-# if _LIBCPP_STD_VER >= 23
- if (__parser_.__type_ == __format_spec::__type::__debug)
- return __formatter::__format_escaped_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
-# endif
-
- return __formatter::__write_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
- }
-
-# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; }
-# endif
-
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left};
-};
-
-// Formatter const char*.
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> {
- using _Base = __formatter_string<_CharT>;
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const {
- _LIBCPP_ASSERT_INTERNAL(__str, "The basic_format_arg constructor should have prevented an invalid pointer.");
-
- __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx);
-# if _LIBCPP_STD_VER >= 23
- if (_Base::__parser_.__type_ == __format_spec::__type::__debug)
- return __formatter::__format_escaped_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
-# endif
-
- // When using a center or right alignment and the width option the length
- // of __str must be known to add the padding upfront. This case is handled
- // by the base class by converting the argument to a basic_string_view.
- //
- // When using left alignment and the width option the padding is added
- // after outputting __str so the length can be determined while outputting
- // __str. The same holds true for the precision, during outputting __str it
- // can be validated whether the precision threshold has been reached. For
- // now these optimizations aren't implemented. Instead the base class
- // handles these options.
- // TODO FMT Implement these improvements.
- if (__specs.__has_width() || __specs.__has_precision())
- return __formatter::__write_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
-
- // No formatting required, copy the string to the output.
- auto __out_it = __ctx.out();
- while (*__str)
- *__out_it++ = *__str++;
- return __out_it;
- }
-};
-
-// Formatter char*.
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT> : public formatter<const _CharT*, _CharT> {
- using _Base = formatter<const _CharT*, _CharT>;
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_CharT* __str, _FormatContext& __ctx) const {
- return _Base::format(__str, __ctx);
- }
-};
-
-// Formatter char[].
-template <__fmt_char_type _CharT, size_t _Size>
-struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT> : public __formatter_string<_CharT> {
- using _Base = __formatter_string<_CharT>;
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(const _CharT (&__str)[_Size], _FormatContext& __ctx) const {
- return _Base::format(basic_string_view<_CharT>(__str, _Size), __ctx);
- }
-};
-
-// Formatter std::string.
-template <__fmt_char_type _CharT, class _Traits, class _Allocator>
-struct _LIBCPP_TEMPLATE_VIS formatter<basic_string<_CharT, _Traits, _Allocator>, _CharT>
- : public __formatter_string<_CharT> {
- using _Base = __formatter_string<_CharT>;
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(const basic_string<_CharT, _Traits, _Allocator>& __str, _FormatContext& __ctx) const {
- // Drop _Traits and _Allocator to have one std::basic_string formatter.
- return _Base::format(basic_string_view<_CharT>(__str.data(), __str.size()), __ctx);
- }
-};
-
-// Formatter std::string_view.
-template <__fmt_char_type _CharT, class _Traits>
-struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT> : public __formatter_string<_CharT> {
- using _Base = __formatter_string<_CharT>;
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(basic_string_view<_CharT, _Traits> __str, _FormatContext& __ctx) const {
- // Drop _Traits to have one std::basic_string_view formatter.
- return _Base::format(basic_string_view<_CharT>(__str.data(), __str.size()), __ctx);
- }
-};
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_STRING_H
diff --git a/libcxx/include/__cxx03/__format/formatter_tuple.h b/libcxx/include/__cxx03/__format/formatter_tuple.h
deleted file mode 100644
index 0a5ce4e070a64..0000000000000
--- a/libcxx/include/__cxx03/__format/formatter_tuple.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_FORMATTER_TUPLE_H
-#define _LIBCPP___CXX03___FORMAT_FORMATTER_TUPLE_H
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/buffer.h>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_context.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/string_view>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args>
-struct _LIBCPP_TEMPLATE_VIS __formatter_tuple {
- _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept {
- __separator_ = __separator;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void
- set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept {
- __opening_bracket_ = __opening_bracket;
- __closing_bracket_ = __closing_bracket;
- }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- auto __begin = __parser_.__parse(__ctx, __format_spec::__fields_tuple);
-
- auto __end = __ctx.end();
- // Note 'n' is part of the type here
- if (__parser_.__clear_brackets_)
- set_brackets({}, {});
- else if (__begin != __end && *__begin == _CharT('m')) {
- if constexpr (sizeof...(_Args) == 2) {
- set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": "));
- set_brackets({}, {});
- ++__begin;
- } else
- std::__throw_format_error("Type m requires a pair or a tuple with two elements");
- }
-
- if (__begin != __end && *__begin != _CharT('}'))
- std::__throw_format_error("The format specifier should consume the input or end with a '}'");
-
- __ctx.advance_to(__begin);
-
- // [format.tuple]/7
- // ... For each element e in underlying_, if e.set_debug_format()
- // is a valid expression, calls e.set_debug_format().
- std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> {
- auto& __formatter = std::get<_Index>(__underlying_);
- __formatter.parse(__ctx);
- // Unlike the range_formatter we don't guard against evil parsers. Since
- // this format-spec never has a format-spec for the underlying type
- // adding the test would give additional overhead.
- std::__set_debug_format(__formatter);
- });
-
- return __begin;
- }
-
- template <class _FormatContext>
- typename _FormatContext::iterator _LIBCPP_HIDE_FROM_ABI
- format(conditional_t<(formattable<const _Args, _CharT> && ...), const _Tuple&, _Tuple&> __tuple,
- _FormatContext& __ctx) const {
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
-
- if (!__specs.__has_width())
- return __format_tuple(__tuple, __ctx);
-
- // The size of the buffer needed is:
- // - open bracket characters
- // - close bracket character
- // - n elements where every element may have a different size
- // - (n -1) separators
- // The size of the element is hard to predict, knowing the type helps but
- // it depends on the format-spec. As an initial estimate we guess 6
- // characters.
- // Typically both brackets are 1 character and the separator is 2
- // characters. Which means there will be
- // (n - 1) * 2 + 1 + 1 = n * 2 character
- // So estimate 8 times the range size as buffer.
- __format::__retarget_buffer<_CharT> __buffer{8 * tuple_size_v<_Tuple>};
- basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> __c{
- __buffer.__make_output_iterator(), __ctx};
-
- __format_tuple(__tuple, __c);
-
- return __formatter::__write_string_no_precision(basic_string_view{__buffer.__view()}, __ctx.out(), __specs);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_tuple(auto&& __tuple, _FormatContext& __ctx) const {
- __ctx.advance_to(std::ranges::copy(__opening_bracket_, __ctx.out()).out);
-
- std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> {
- if constexpr (_Index)
- __ctx.advance_to(std::ranges::copy(__separator_, __ctx.out()).out);
- __ctx.advance_to(std::get<_Index>(__underlying_).format(std::get<_Index>(__tuple), __ctx));
- });
-
- return std::ranges::copy(__closing_bracket_, __ctx.out()).out;
- }
-
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left};
-
-private:
- tuple<formatter<remove_cvref_t<_Args>, _CharT>...> __underlying_;
- basic_string_view<_CharT> __separator_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ", ");
- basic_string_view<_CharT> __opening_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "(");
- basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ")");
-};
-
-template <__fmt_char_type _CharT, formattable<_CharT>... _Args>
-struct _LIBCPP_TEMPLATE_VIS formatter<pair<_Args...>, _CharT>
- : public __formatter_tuple<_CharT, pair<_Args...>, _Args...> {};
-
-template <__fmt_char_type _CharT, formattable<_CharT>... _Args>
-struct _LIBCPP_TEMPLATE_VIS formatter<tuple<_Args...>, _CharT>
- : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {};
-
-#endif //_LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_FORMATTER_TUPLE_H
diff --git a/libcxx/include/__cxx03/__format/indic_conjunct_break_table.h b/libcxx/include/__cxx03/__format/indic_conjunct_break_table.h
deleted file mode 100644
index 37fbde2998736..0000000000000
--- a/libcxx/include/__cxx03/__format/indic_conjunct_break_table.h
+++ /dev/null
@@ -1,350 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// WARNING, this entire header is generated by
-// utils/generate_indic_conjunct_break_table.py
-// DO NOT MODIFY!
-
-// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-//
-// See Terms of Use <https://www.unicode.org/copyright.html>
-// for definitions of Unicode Inc.'s Data Files and Software.
-//
-// NOTICE TO USER: Carefully read the following legal agreement.
-// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
-// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
-// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
-// TERMS AND CONDITIONS OF THIS AGREEMENT.
-// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
-// THE DATA FILES OR SOFTWARE.
-//
-// COPYRIGHT AND PERMISSION NOTICE
-//
-// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved.
-// Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of the Unicode data files and any associated documentation
-// (the "Data Files") or Unicode software and any associated documentation
-// (the "Software") to deal in the Data Files or Software
-// without restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, and/or sell copies of
-// the Data Files or Software, and to permit persons to whom the Data Files
-// or Software are furnished to do so, provided that either
-// (a) this copyright and permission notice appear with all copies
-// of the Data Files or Software, or
-// (b) this copyright and permission notice appear in associated
-// Documentation.
-//
-// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-//
-// Except as contained in this notice, the name of a copyright holder
-// shall not be used in advertising or otherwise to promote the sale,
-// use or other dealings in these Data Files or Software without prior
-// written authorization of the copyright holder.
-
-#ifndef _LIBCPP___CXX03___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
-#define _LIBCPP___CXX03___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
-
-#include <__cxx03/__algorithm/ranges_upper_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/access.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __indic_conjunct_break {
-
-enum class __property : uint8_t {
- // Values generated from the data files.
- __Consonant,
- __Extend,
- __Linker,
-
- // The code unit has none of above properties.
- __none
-};
-
-/// The entries of the indic conjunct break property table.
-///
-/// The data is generated from
-/// - https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt
-///
-/// The data has 3 values
-/// - bits [0, 1] The property. One of the values generated from the datafiles
-/// of \ref __property
-/// - bits [2, 10] The size of the range.
-/// - bits [11, 31] The lower bound code point of the range. The upper bound of
-/// the range is lower bound + size.
-///
-/// The 9 bits for the size allow a maximum range of 512 elements. Some ranges
-/// in the Unicode tables are larger. They are stored in multiple consecutive
-/// ranges in the data table. An alternative would be to store the sizes in a
-/// separate 16-bit value. The original MSVC STL code had such an approach, but
-/// this approach uses less space for the data and is about 4% faster in the
-/// following benchmark.
-/// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
-// clang-format off
-_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[201] = {
- 0x00180139,
- 0x001a807d,
- 0x00241811,
- 0x002c88b1,
- 0x002df801,
- 0x002e0805,
- 0x002e2005,
- 0x002e3801,
- 0x00308029,
- 0x00325851,
- 0x00338001,
- 0x0036b019,
- 0x0036f815,
- 0x00373805,
- 0x0037500d,
- 0x00388801,
- 0x00398069,
- 0x003f5821,
- 0x003fe801,
- 0x0040b00d,
- 0x0040d821,
- 0x00412809,
- 0x00414811,
- 0x0042c809,
- 0x0044c01d,
- 0x0046505d,
- 0x00471871,
- 0x0048a890,
- 0x0049e001,
- 0x004a6802,
- 0x004a880d,
- 0x004ac01c,
- 0x004bc01c,
- 0x004ca84c,
- 0x004d5018,
- 0x004d9000,
- 0x004db00c,
- 0x004de001,
- 0x004e6802,
- 0x004ee004,
- 0x004ef800,
- 0x004f8004,
- 0x004ff001,
- 0x0051e001,
- 0x0054a84c,
- 0x00555018,
- 0x00559004,
- 0x0055a810,
- 0x0055e001,
- 0x00566802,
- 0x0057c800,
- 0x0058a84c,
- 0x00595018,
- 0x00599004,
- 0x0059a810,
- 0x0059e001,
- 0x005a6802,
- 0x005ae004,
- 0x005af800,
- 0x005b8800,
- 0x0060a84c,
- 0x0061503c,
- 0x0061e001,
- 0x00626802,
- 0x0062a805,
- 0x0062c008,
- 0x0065e001,
- 0x0068a894,
- 0x0069d805,
- 0x006a6802,
- 0x0071c009,
- 0x0072400d,
- 0x0075c009,
- 0x0076400d,
- 0x0078c005,
- 0x0079a801,
- 0x0079b801,
- 0x0079c801,
- 0x007b8805,
- 0x007ba001,
- 0x007bd00d,
- 0x007c0001,
- 0x007c1009,
- 0x007c3005,
- 0x007e3001,
- 0x0081b801,
- 0x0081c805,
- 0x00846801,
- 0x009ae809,
- 0x00b8a001,
- 0x00be9001,
- 0x00bee801,
- 0x00c54801,
- 0x00c9c809,
- 0x00d0b805,
- 0x00d30001,
- 0x00d3a81d,
- 0x00d3f801,
- 0x00d58035,
- 0x00d5f83d,
- 0x00d9a001,
- 0x00db5821,
- 0x00dd5801,
- 0x00df3001,
- 0x00e1b801,
- 0x00e68009,
- 0x00e6a031,
- 0x00e71019,
- 0x00e76801,
- 0x00e7a001,
- 0x00e7c005,
- 0x00ee00fd,
- 0x01006801,
- 0x01068031,
- 0x01070801,
- 0x0107282d,
- 0x01677809,
- 0x016bf801,
- 0x016f007d,
- 0x01815015,
- 0x0184c805,
- 0x05337801,
- 0x0533a025,
- 0x0534f005,
- 0x05378005,
- 0x05416001,
- 0x05470045,
- 0x05495809,
- 0x054d9801,
- 0x05558001,
- 0x05559009,
- 0x0555b805,
- 0x0555f005,
- 0x05560801,
- 0x0557b001,
- 0x055f6801,
- 0x07d8f001,
- 0x07f1003d,
- 0x080fe801,
- 0x08170001,
- 0x081bb011,
- 0x08506801,
- 0x08507801,
- 0x0851c009,
- 0x0851f801,
- 0x08572805,
- 0x0869200d,
- 0x08755805,
- 0x0877e809,
- 0x087a3029,
- 0x087c100d,
- 0x08838001,
- 0x0883f801,
- 0x0885d001,
- 0x08880009,
- 0x08899805,
- 0x088b9801,
- 0x088e5001,
- 0x0891b001,
- 0x08974805,
- 0x0899d805,
- 0x089b3019,
- 0x089b8011,
- 0x08a23001,
- 0x08a2f001,
- 0x08a61801,
- 0x08ae0001,
- 0x08b5b801,
- 0x08b95801,
- 0x08c1d001,
- 0x08c9f001,
- 0x08ca1801,
- 0x08d1a001,
- 0x08d23801,
- 0x08d4c801,
- 0x08ea1001,
- 0x08ea2005,
- 0x08ecb801,
- 0x08fa1001,
- 0x0b578011,
- 0x0b598019,
- 0x0de4f001,
- 0x0e8b2801,
- 0x0e8b3809,
- 0x0e8b7011,
- 0x0e8bd81d,
- 0x0e8c2819,
- 0x0e8d500d,
- 0x0e921009,
- 0x0f000019,
- 0x0f004041,
- 0x0f00d819,
- 0x0f011805,
- 0x0f013011,
- 0x0f047801,
- 0x0f098019,
- 0x0f157001,
- 0x0f17600d,
- 0x0f27600d,
- 0x0f468019,
- 0x0f4a2019};
-// clang-format on
-
-/// Returns the indic conjuct break property of a code point.
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept {
- // The algorithm searches for the upper bound of the range and, when found,
- // steps back one entry. This algorithm is used since the code point can be
- // anywhere in the range. After a lower bound is found the next step is to
- // compare whether the code unit is indeed in the range.
- //
- // Since the entry contains a code unit, size, and property the code point
- // being sought needs to be adjusted. Just shifting the code point to the
- // proper position doesn't work; suppose an entry has property 0, size 1,
- // and lower bound 3. This results in the entry 0x1810.
- // When searching for code point 3 it will search for 0x1800, find 0x1810
- // and moves to the previous entry. Thus the lower bound value will never
- // be found.
- // The simple solution is to set the bits belonging to the property and
- // size. Then the upper bound for code point 3 will return the entry after
- // 0x1810. After moving to the previous entry the algorithm arrives at the
- // correct entry.
- ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
- if (__i == 0)
- return __property::__none;
-
- --__i;
- uint32_t __upper_bound = (__entries[__i] >> 11) + ((__entries[__i] >> 2) & 0b1'1111'1111);
- if (__code_point <= __upper_bound)
- return static_cast<__property>(__entries[__i] & 0b11);
-
- return __property::__none;
-}
-
-} // namespace __indic_conjunct_break
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_INDIC_CONJUNCT_BREAK_TABLE_H
diff --git a/libcxx/include/__cxx03/__format/parser_std_format_spec.h b/libcxx/include/__cxx03/__format/parser_std_format_spec.h
deleted file mode 100644
index 394b6e655e726..0000000000000
--- a/libcxx/include/__cxx03/__format/parser_std_format_spec.h
+++ /dev/null
@@ -1,1172 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_PARSER_STD_FORMAT_SPEC_H
-#define _LIBCPP___CXX03___FORMAT_PARSER_STD_FORMAT_SPEC_H
-
-/// \file Contains the std-format-spec parser.
-///
-/// Most of the code can be reused in the chrono-format-spec.
-/// This header has some support for the chrono-format-spec since it doesn't
-/// affect the std-format-spec.
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/format_arg.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/format_string.h>
-#include <__cxx03/__format/unicode.h>
-#include <__cxx03/__format/width_estimation_table.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h> // iter_value_t
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/is_constant_evaluated.h>
-#include <__cxx03/__type_traits/is_trivially_copyable.h>
-#include <__cxx03/__variant/monostate.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __format_spec {
-
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void
-__throw_invalid_option_format_error(const char* __id, const char* __option) {
- std::__throw_format_error(
- (string("The format specifier for ") + __id + " does not allow the " + __option + " option").c_str());
-}
-
-_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __throw_invalid_type_format_error(const char* __id) {
- std::__throw_format_error(
- (string("The type option contains an invalid value for ") + __id + " formatting argument").c_str());
-}
-
-template <contiguous_iterator _Iterator, class _ParseContext>
-_LIBCPP_HIDE_FROM_ABI constexpr __format::__parse_number_result<_Iterator>
-__parse_arg_id(_Iterator __begin, _Iterator __end, _ParseContext& __ctx) {
- using _CharT = iter_value_t<_Iterator>;
- // This function is a wrapper to call the real parser. But it does the
- // validation for the pre-conditions and post-conditions.
- if (__begin == __end)
- std::__throw_format_error("End of input while parsing an argument index");
-
- __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __ctx);
-
- if (__r.__last == __end || *__r.__last != _CharT('}'))
- std::__throw_format_error("The argument index is invalid");
-
- ++__r.__last;
- return __r;
-}
-
-template <class _Context>
-_LIBCPP_HIDE_FROM_ABI constexpr uint32_t __substitute_arg_id(basic_format_arg<_Context> __format_arg) {
- // [format.string.std]/8
- // If the corresponding formatting argument is not of integral type...
- // This wording allows char and bool too. LWG-3720 changes the wording to
- // If the corresponding formatting argument is not of standard signed or
- // unsigned integer type,
- // This means the 128-bit will not be valid anymore.
- // TODO FMT Verify this resolution is accepted and add a test to verify
- // 128-bit integrals fail and switch to visit_format_arg.
- return std::__visit_format_arg(
- [](auto __arg) -> uint32_t {
- using _Type = decltype(__arg);
- if constexpr (same_as<_Type, monostate>)
- std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
-
- // [format.string.std]/8
- // If { arg-idopt } is used in a width or precision, the value of the
- // corresponding formatting argument is used in its place. If the
- // corresponding formatting argument is not of standard signed or unsigned
- // integer type, or its value is negative for precision or non-positive for
- // width, an exception of type format_error is thrown.
- //
- // When an integral is used in a format function, it is stored as one of
- // the types checked below. Other integral types are promoted. For example,
- // a signed char is stored as an int.
- if constexpr (same_as<_Type, int> || same_as<_Type, unsigned int> || //
- same_as<_Type, long long> || same_as<_Type, unsigned long long>) {
- if constexpr (signed_integral<_Type>) {
- if (__arg < 0)
- std::__throw_format_error("An argument index may not have a negative value");
- }
-
- using _CT = common_type_t<_Type, decltype(__format::__number_max)>;
- if (static_cast<_CT>(__arg) > static_cast<_CT>(__format::__number_max))
- std::__throw_format_error("The value of the argument index exceeds its maximum value");
-
- return __arg;
- } else
- std::__throw_format_error("Replacement argument isn't a standard signed or unsigned integer type");
- },
- __format_arg);
-}
-
-/// These fields are a filter for which elements to parse.
-///
-/// They default to false so when a new field is added it needs to be opted in
-/// explicitly.
-struct _LIBCPP_HIDE_FROM_ABI __fields {
- uint16_t __sign_ : 1 {false};
- uint16_t __alternate_form_ : 1 {false};
- uint16_t __zero_padding_ : 1 {false};
- uint16_t __precision_ : 1 {false};
- uint16_t __locale_specific_form_ : 1 {false};
- uint16_t __type_ : 1 {false};
- // Determines the valid values for fill.
- //
- // Originally the fill could be any character except { and }. Range-based
- // formatters use the colon to mark the beginning of the
- // underlying-format-spec. To avoid parsing ambiguities these formatter
- // specializations prohibit the use of the colon as a fill character.
- uint16_t __use_range_fill_ : 1 {false};
- uint16_t __clear_brackets_ : 1 {false};
- uint16_t __consume_all_ : 1 {false};
-};
-
-// By not placing this constant in the formatter class it's not duplicated for
-// char and wchar_t.
-inline constexpr __fields __fields_bool{.__locale_specific_form_ = true, .__type_ = true, .__consume_all_ = true};
-inline constexpr __fields __fields_integral{
- .__sign_ = true,
- .__alternate_form_ = true,
- .__zero_padding_ = true,
- .__locale_specific_form_ = true,
- .__type_ = true,
- .__consume_all_ = true};
-inline constexpr __fields __fields_floating_point{
- .__sign_ = true,
- .__alternate_form_ = true,
- .__zero_padding_ = true,
- .__precision_ = true,
- .__locale_specific_form_ = true,
- .__type_ = true,
- .__consume_all_ = true};
-inline constexpr __fields __fields_string{.__precision_ = true, .__type_ = true, .__consume_all_ = true};
-inline constexpr __fields __fields_pointer{.__zero_padding_ = true, .__type_ = true, .__consume_all_ = true};
-
-# if _LIBCPP_STD_VER >= 23
-inline constexpr __fields __fields_tuple{.__use_range_fill_ = true, .__clear_brackets_ = true};
-inline constexpr __fields __fields_range{.__use_range_fill_ = true, .__clear_brackets_ = true};
-inline constexpr __fields __fields_fill_align_width{};
-# endif
-
-enum class __alignment : uint8_t {
- /// No alignment is set in the format string.
- __default,
- __left,
- __center,
- __right,
- __zero_padding
-};
-
-enum class __sign : uint8_t {
- /// No sign is set in the format string.
- ///
- /// The sign isn't allowed for certain format-types. By using this value
- /// it's possible to detect whether or not the user explicitly set the sign
- /// flag. For formatting purposes it behaves the same as \ref __minus.
- __default,
- __minus,
- __plus,
- __space
-};
-
-enum class __type : uint8_t {
- __default = 0,
- __string,
- __binary_lower_case,
- __binary_upper_case,
- __octal,
- __decimal,
- __hexadecimal_lower_case,
- __hexadecimal_upper_case,
- __pointer_lower_case,
- __pointer_upper_case,
- __char,
- __hexfloat_lower_case,
- __hexfloat_upper_case,
- __scientific_lower_case,
- __scientific_upper_case,
- __fixed_lower_case,
- __fixed_upper_case,
- __general_lower_case,
- __general_upper_case,
- __debug
-};
-
-_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __create_type_mask(__type __t) {
- uint32_t __shift = static_cast<uint32_t>(__t);
- if (__shift == 0)
- return 1;
-
- if (__shift > 31)
- std::__throw_format_error("The type does not fit in the mask");
-
- return 1 << __shift;
-}
-
-inline constexpr uint32_t __type_mask_integer =
- __create_type_mask(__type::__binary_lower_case) | //
- __create_type_mask(__type::__binary_upper_case) | //
- __create_type_mask(__type::__decimal) | //
- __create_type_mask(__type::__octal) | //
- __create_type_mask(__type::__hexadecimal_lower_case) | //
- __create_type_mask(__type::__hexadecimal_upper_case);
-
-struct __std {
- __alignment __alignment_ : 3;
- __sign __sign_ : 2;
- bool __alternate_form_ : 1;
- bool __locale_specific_form_ : 1;
- __type __type_;
-};
-
-struct __chrono {
- __alignment __alignment_ : 3;
- bool __locale_specific_form_ : 1;
- bool __hour_ : 1;
- bool __weekday_name_ : 1;
- bool __weekday_ : 1;
- bool __day_of_year_ : 1;
- bool __week_of_year_ : 1;
- bool __month_name_ : 1;
-};
-
-// The fill UCS scalar value.
-//
-// This is always an array, with 1, 2, or 4 elements.
-// The size of the data structure is always 32-bits.
-template <class _CharT>
-struct __code_point;
-
-template <>
-struct __code_point<char> {
- char __data[4] = {' '};
-};
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <>
-struct __code_point<wchar_t> {
- wchar_t __data[4 / sizeof(wchar_t)] = {L' '};
-};
-# endif
-
-/// Contains the parsed formatting specifications.
-///
-/// This contains information for both the std-format-spec and the
-/// chrono-format-spec. This results in some unused members for both
-/// specifications. However these unused members don't increase the size
-/// of the structure.
-///
-/// This struct doesn't cross ABI boundaries so its layout doesn't need to be
-/// kept stable.
-template <class _CharT>
-struct __parsed_specifications {
- union {
- // The field __alignment_ is the first element in __std_ and __chrono_.
- // This allows the code to always inspect this value regards which member
- // of the union is the active member [class.union.general]/2.
- //
- // This is needed since the generic output routines handle the alignment of
- // the output.
- __alignment __alignment_ : 3;
- __std __std_;
- __chrono __chrono_;
- };
-
- /// The requested width.
- ///
- /// When the format-spec used an arg-id for this field it has already been
- /// replaced with the value of that arg-id.
- int32_t __width_;
-
- /// The requested precision.
- ///
- /// When the format-spec used an arg-id for this field it has already been
- /// replaced with the value of that arg-id.
- int32_t __precision_;
-
- __code_point<_CharT> __fill_;
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_width() const { return __width_ > 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_precision() const { return __precision_ >= 0; }
-};
-
-// Validate the struct is small and cheap to copy since the struct is passed by
-// value in formatting functions.
-static_assert(sizeof(__parsed_specifications<char>) == 16);
-static_assert(is_trivially_copyable_v<__parsed_specifications<char>>);
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static_assert(sizeof(__parsed_specifications<wchar_t>) == 16);
-static_assert(is_trivially_copyable_v<__parsed_specifications<wchar_t>>);
-# endif
-
-/// The parser for the std-format-spec.
-///
-/// Note this class is a member of std::formatter specializations. It's
-/// expected developers will create their own formatter specializations that
-/// inherit from the std::formatter specializations. This means this class
-/// must be ABI stable. To aid the stability the unused bits in the class are
-/// set to zero. That way they can be repurposed if a future revision of the
-/// Standards adds new fields to std-format-spec.
-template <class _CharT>
-class _LIBCPP_TEMPLATE_VIS __parser {
-public:
- // Parses the format specification.
- //
- // Depending on whether the parsing is done compile-time or run-time
- // the method slightly differs.
- // - Only parses a field when it is in the __fields. Accepting all
- // fields and then validating the valid ones has a performance impact.
- // This is faster but gives slighly worse error messages.
- // - At compile-time when a field is not accepted the parser will still
- // parse it and give an error when it's present. This gives a more
- // accurate error.
- // The idea is that most times the format instead of the vformat
- // functions are used. In that case the error will be detected during
- // compilation and there is no need to pay for the run-time overhead.
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator __parse(_ParseContext& __ctx, __fields __fields) {
- auto __begin = __ctx.begin();
- auto __end = __ctx.end();
- if (__begin == __end || *__begin == _CharT('}') || (__fields.__use_range_fill_ && *__begin == _CharT(':')))
- return __begin;
-
- if (__parse_fill_align(__begin, __end) && __begin == __end)
- return __begin;
-
- if (__fields.__sign_) {
- if (__parse_sign(__begin) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_sign(__begin)) {
- std::__throw_format_error("The format specification does not allow the sign option");
- }
-
- if (__fields.__alternate_form_) {
- if (__parse_alternate_form(__begin) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_alternate_form(__begin)) {
- std::__throw_format_error("The format specifier does not allow the alternate form option");
- }
-
- if (__fields.__zero_padding_) {
- if (__parse_zero_padding(__begin) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_zero_padding(__begin)) {
- std::__throw_format_error("The format specifier does not allow the zero-padding option");
- }
-
- if (__parse_width(__begin, __end, __ctx) && __begin == __end)
- return __begin;
-
- if (__fields.__precision_) {
- if (__parse_precision(__begin, __end, __ctx) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_precision(__begin, __end, __ctx)) {
- std::__throw_format_error("The format specifier does not allow the precision option");
- }
-
- if (__fields.__locale_specific_form_) {
- if (__parse_locale_specific_form(__begin) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_locale_specific_form(__begin)) {
- std::__throw_format_error("The format specifier does not allow the locale-specific form option");
- }
-
- if (__fields.__clear_brackets_) {
- if (__parse_clear_brackets(__begin) && __begin == __end)
- return __begin;
- } else if (std::is_constant_evaluated() && __parse_clear_brackets(__begin)) {
- std::__throw_format_error("The format specifier does not allow the n option");
- }
-
- if (__fields.__type_)
- __parse_type(__begin);
-
- if (!__fields.__consume_all_)
- return __begin;
-
- if (__begin != __end && *__begin != _CharT('}'))
- std::__throw_format_error("The format specifier should consume the input or end with a '}'");
-
- return __begin;
- }
-
- // Validates the selected the parsed data.
- //
- // The valid fields in the parser may depend on the display type
- // selected. But the type is the last optional field, so by the time
- // it's known an option can't be used, it already has been parsed.
- // This does the validation again.
- //
- // For example an integral may have a sign, zero-padding, or alternate
- // form when the type option is not 'c'. So the generic approach is:
- //
- // typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral);
- // if (__parser.__type_ == __format_spec::__type::__char) {
- // __parser.__validate((__format_spec::__fields_bool, "an integer");
- // ... // more char adjustments
- // } else {
- // ... // validate an integral type.
- // }
- //
- // For some types all valid options need a second validation run, like
- // boolean types.
- //
- // Depending on whether the validation is done at compile-time or
- // run-time the error differs
- // - run-time the exception is thrown and contains the type of field
- // being validated.
- // - at compile-time the line with `std::__throw_format_error` is shown
- // in the output. In that case it's important for the error to be on one
- // line.
- // Note future versions of C++ may allow better compile-time error
- // reporting.
- _LIBCPP_HIDE_FROM_ABI constexpr void
- __validate(__fields __fields, const char* __id, uint32_t __type_mask = -1) const {
- if (!__fields.__sign_ && __sign_ != __sign::__default) {
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier does not allow the sign option");
- else
- __format_spec::__throw_invalid_option_format_error(__id, "sign");
- }
-
- if (!__fields.__alternate_form_ && __alternate_form_) {
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier does not allow the alternate form option");
- else
- __format_spec::__throw_invalid_option_format_error(__id, "alternate form");
- }
-
- if (!__fields.__zero_padding_ && __alignment_ == __alignment::__zero_padding) {
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier does not allow the zero-padding option");
- else
- __format_spec::__throw_invalid_option_format_error(__id, "zero-padding");
- }
-
- if (!__fields.__precision_ && __precision_ != -1) { // Works both when the precision has a value or an arg-id.
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier does not allow the precision option");
- else
- __format_spec::__throw_invalid_option_format_error(__id, "precision");
- }
-
- if (!__fields.__locale_specific_form_ && __locale_specific_form_) {
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier does not allow the locale-specific form option");
- else
- __format_spec::__throw_invalid_option_format_error(__id, "locale-specific form");
- }
-
- if ((__create_type_mask(__type_) & __type_mask) == 0) {
- if (std::is_constant_evaluated())
- std::__throw_format_error("The format specifier uses an invalid value for the type option");
- else
- __format_spec::__throw_invalid_type_format_error(__id);
- }
- }
-
- /// \returns the `__parsed_specifications` with the resolved dynamic sizes..
- _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
- return __parsed_specifications<_CharT>{
- .__std_ = __std{.__alignment_ = __alignment_,
- .__sign_ = __sign_,
- .__alternate_form_ = __alternate_form_,
- .__locale_specific_form_ = __locale_specific_form_,
- .__type_ = __type_},
- .__width_{__get_width(__ctx)},
- .__precision_{__get_precision(__ctx)},
- .__fill_{__fill_}};
- }
-
- _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_chrono_specifications(auto& __ctx) const {
- return __parsed_specifications<_CharT>{
- .__chrono_ =
- __chrono{.__alignment_ = __alignment_,
- .__locale_specific_form_ = __locale_specific_form_,
- .__hour_ = __hour_,
- .__weekday_name_ = __weekday_name_,
- .__weekday_ = __weekday_,
- .__day_of_year_ = __day_of_year_,
- .__week_of_year_ = __week_of_year_,
- .__month_name_ = __month_name_},
- .__width_{__get_width(__ctx)},
- .__precision_{__get_precision(__ctx)},
- .__fill_{__fill_}};
- }
-
- __alignment __alignment_ : 3 {__alignment::__default};
- __sign __sign_ : 2 {__sign::__default};
- bool __alternate_form_ : 1 {false};
- bool __locale_specific_form_ : 1 {false};
- bool __clear_brackets_ : 1 {false};
- __type __type_{__type::__default};
-
- // These flags are only used for formatting chrono. Since the struct has
- // padding space left it's added to this structure.
- bool __hour_ : 1 {false};
-
- bool __weekday_name_ : 1 {false};
- bool __weekday_ : 1 {false};
-
- bool __day_of_year_ : 1 {false};
- bool __week_of_year_ : 1 {false};
-
- bool __month_name_ : 1 {false};
-
- uint8_t __reserved_0_ : 2 {0};
- uint8_t __reserved_1_ : 6 {0};
- // These two flags are only used internally and not part of the
- // __parsed_specifications. Therefore put them at the end.
- bool __width_as_arg_ : 1 {false};
- bool __precision_as_arg_ : 1 {false};
-
- /// The requested width, either the value or the arg-id.
- int32_t __width_{0};
-
- /// The requested precision, either the value or the arg-id.
- int32_t __precision_{-1};
-
- __code_point<_CharT> __fill_{};
-
-private:
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_alignment(_CharT __c) {
- switch (__c) {
- case _CharT('<'):
- __alignment_ = __alignment::__left;
- return true;
-
- case _CharT('^'):
- __alignment_ = __alignment::__center;
- return true;
-
- case _CharT('>'):
- __alignment_ = __alignment::__right;
- return true;
- }
- return false;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __validate_fill_character(_CharT __fill) {
- // The forbidden fill characters all code points formed from a single code unit, thus the
- // check can be omitted when more code units are used.
- if (__fill == _CharT('{'))
- std::__throw_format_error("The fill option contains an invalid value");
- }
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
- // range-fill and tuple-fill are identical
- template <contiguous_iterator _Iterator>
- requires same_as<_CharT, char>
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- || (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2)
-# endif
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
- __unicode::__code_point_view<_CharT> __view{__begin, __end};
- __unicode::__consume_result __consumed = __view.__consume();
- if (__consumed.__status != __unicode::__consume_result::__ok)
- std::__throw_format_error("The format specifier contains malformed Unicode characters");
-
- if (__view.__position() < __end && __parse_alignment(*__view.__position())) {
- ptrdiff_t __code_units = __view.__position() - __begin;
- if (__code_units == 1)
- // The forbidden fill characters all are code points encoded
- // in one code unit, thus the check can be omitted when more
- // code units are used.
- __validate_fill_character(*__begin);
-
- std::copy_n(__begin, __code_units, std::addressof(__fill_.__data[0]));
- __begin += __code_units + 1;
- return true;
- }
-
- if (!__parse_alignment(*__begin))
- return false;
-
- ++__begin;
- return true;
- }
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <contiguous_iterator _Iterator>
- requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4)
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
- if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) {
- if (!__unicode::__is_scalar_value(*__begin))
- std::__throw_format_error("The fill option contains an invalid value");
-
- __validate_fill_character(*__begin);
-
- __fill_.__data[0] = *__begin;
- __begin += 2;
- return true;
- }
-
- if (!__parse_alignment(*__begin))
- return false;
-
- ++__begin;
- return true;
- }
-
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-# else // _LIBCPP_HAS_NO_UNICODE
- // range-fill and tuple-fill are identical
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __begin != __end,
- "when called with an empty input the function will cause "
- "undefined behavior by evaluating data not in the input");
- if (__begin + 1 != __end) {
- if (__parse_alignment(*(__begin + 1))) {
- __validate_fill_character(*__begin);
-
- __fill_.__data[0] = *__begin;
- __begin += 2;
- return true;
- }
- }
-
- if (!__parse_alignment(*__begin))
- return false;
-
- ++__begin;
- return true;
- }
-
-# endif // _LIBCPP_HAS_NO_UNICODE
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_sign(_Iterator& __begin) {
- switch (*__begin) {
- case _CharT('-'):
- __sign_ = __sign::__minus;
- break;
- case _CharT('+'):
- __sign_ = __sign::__plus;
- break;
- case _CharT(' '):
- __sign_ = __sign::__space;
- break;
- default:
- return false;
- }
- ++__begin;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_alternate_form(_Iterator& __begin) {
- if (*__begin != _CharT('#'))
- return false;
-
- __alternate_form_ = true;
- ++__begin;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_zero_padding(_Iterator& __begin) {
- if (*__begin != _CharT('0'))
- return false;
-
- if (__alignment_ == __alignment::__default)
- __alignment_ = __alignment::__zero_padding;
- ++__begin;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(_Iterator& __begin, _Iterator __end, auto& __ctx) {
- if (*__begin == _CharT('0'))
- std::__throw_format_error("The width option should not have a leading zero");
-
- if (*__begin == _CharT('{')) {
- __format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __width_as_arg_ = true;
- __width_ = __r.__value;
- __begin = __r.__last;
- return true;
- }
-
- if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- return false;
-
- __format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __width_ = __r.__value;
- _LIBCPP_ASSERT_INTERNAL(__width_ != 0,
- "A zero value isn't allowed and should be impossible, "
- "due to validations in this function");
- __begin = __r.__last;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_precision(_Iterator& __begin, _Iterator __end, auto& __ctx) {
- if (*__begin != _CharT('.'))
- return false;
-
- ++__begin;
- if (__begin == __end)
- std::__throw_format_error("End of input while parsing format specifier precision");
-
- if (*__begin == _CharT('{')) {
- __format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
- __precision_as_arg_ = true;
- __precision_ = __arg_id.__value;
- __begin = __arg_id.__last;
- return true;
- }
-
- if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- std::__throw_format_error("The precision option does not contain a value or an argument index");
-
- __format::__parse_number_result __r = __format::__parse_number(__begin, __end);
- __precision_ = __r.__value;
- __precision_as_arg_ = false;
- __begin = __r.__last;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_locale_specific_form(_Iterator& __begin) {
- if (*__begin != _CharT('L'))
- return false;
-
- __locale_specific_form_ = true;
- ++__begin;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_clear_brackets(_Iterator& __begin) {
- if (*__begin != _CharT('n'))
- return false;
-
- __clear_brackets_ = true;
- ++__begin;
- return true;
- }
-
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(_Iterator& __begin) {
- // Determines the type. It does not validate whether the selected type is
- // valid. Most formatters have optional fields that are only allowed for
- // certain types. These parsers need to do validation after the type has
- // been parsed. So its easier to implement the validation for all types in
- // the specific parse function.
- switch (*__begin) {
- case 'A':
- __type_ = __type::__hexfloat_upper_case;
- break;
- case 'B':
- __type_ = __type::__binary_upper_case;
- break;
- case 'E':
- __type_ = __type::__scientific_upper_case;
- break;
- case 'F':
- __type_ = __type::__fixed_upper_case;
- break;
- case 'G':
- __type_ = __type::__general_upper_case;
- break;
- case 'X':
- __type_ = __type::__hexadecimal_upper_case;
- break;
- case 'a':
- __type_ = __type::__hexfloat_lower_case;
- break;
- case 'b':
- __type_ = __type::__binary_lower_case;
- break;
- case 'c':
- __type_ = __type::__char;
- break;
- case 'd':
- __type_ = __type::__decimal;
- break;
- case 'e':
- __type_ = __type::__scientific_lower_case;
- break;
- case 'f':
- __type_ = __type::__fixed_lower_case;
- break;
- case 'g':
- __type_ = __type::__general_lower_case;
- break;
- case 'o':
- __type_ = __type::__octal;
- break;
- case 'p':
- __type_ = __type::__pointer_lower_case;
- break;
- case 'P':
- __type_ = __type::__pointer_upper_case;
- break;
- case 's':
- __type_ = __type::__string;
- break;
- case 'x':
- __type_ = __type::__hexadecimal_lower_case;
- break;
-# if _LIBCPP_STD_VER >= 23
- case '?':
- __type_ = __type::__debug;
- break;
-# endif
- default:
- return;
- }
- ++__begin;
- }
-
- _LIBCPP_HIDE_FROM_ABI int32_t __get_width(auto& __ctx) const {
- if (!__width_as_arg_)
- return __width_;
-
- return __format_spec::__substitute_arg_id(__ctx.arg(__width_));
- }
-
- _LIBCPP_HIDE_FROM_ABI int32_t __get_precision(auto& __ctx) const {
- if (!__precision_as_arg_)
- return __precision_;
-
- return __format_spec::__substitute_arg_id(__ctx.arg(__precision_));
- }
-};
-
-// Validates whether the reserved bitfields don't change the size.
-static_assert(sizeof(__parser<char>) == 16);
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-static_assert(sizeof(__parser<wchar_t>) == 16);
-# endif
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_string(__format_spec::__type __type) {
- switch (__type) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__string:
- case __format_spec::__type::__debug:
- break;
-
- default:
- std::__throw_format_error("The type option contains an invalid value for a string formatting argument");
- }
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_bool_string(__parser<_CharT>& __parser, const char* __id) {
- __parser.__validate(__format_spec::__fields_bool, __id);
- if (__parser.__alignment_ == __alignment::__default)
- __parser.__alignment_ = __alignment::__left;
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_char(__parser<_CharT>& __parser, const char* __id) {
- __format_spec::__process_display_type_bool_string(__parser, __id);
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_bool(__parser<_CharT>& __parser, const char* __id) {
- switch (__parser.__type_) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__string:
- __format_spec::__process_display_type_bool_string(__parser, __id);
- break;
-
- case __format_spec::__type::__binary_lower_case:
- case __format_spec::__type::__binary_upper_case:
- case __format_spec::__type::__octal:
- case __format_spec::__type::__decimal:
- case __format_spec::__type::__hexadecimal_lower_case:
- case __format_spec::__type::__hexadecimal_upper_case:
- break;
-
- default:
- __format_spec::__throw_invalid_type_format_error(__id);
- }
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_char(__parser<_CharT>& __parser, const char* __id) {
- switch (__parser.__type_) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__char:
- case __format_spec::__type::__debug:
- __format_spec::__process_display_type_char(__parser, __id);
- break;
-
- case __format_spec::__type::__binary_lower_case:
- case __format_spec::__type::__binary_upper_case:
- case __format_spec::__type::__octal:
- case __format_spec::__type::__decimal:
- case __format_spec::__type::__hexadecimal_lower_case:
- case __format_spec::__type::__hexadecimal_upper_case:
- break;
-
- default:
- __format_spec::__throw_invalid_type_format_error(__id);
- }
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_integer(__parser<_CharT>& __parser, const char* __id) {
- switch (__parser.__type_) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__binary_lower_case:
- case __format_spec::__type::__binary_upper_case:
- case __format_spec::__type::__octal:
- case __format_spec::__type::__decimal:
- case __format_spec::__type::__hexadecimal_lower_case:
- case __format_spec::__type::__hexadecimal_upper_case:
- break;
-
- case __format_spec::__type::__char:
- __format_spec::__process_display_type_char(__parser, __id);
- break;
-
- default:
- __format_spec::__throw_invalid_type_format_error(__id);
- }
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_parsed_floating_point(__parser<_CharT>& __parser, const char* __id) {
- switch (__parser.__type_) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__hexfloat_lower_case:
- case __format_spec::__type::__hexfloat_upper_case:
- // Precision specific behavior will be handled later.
- break;
- case __format_spec::__type::__scientific_lower_case:
- case __format_spec::__type::__scientific_upper_case:
- case __format_spec::__type::__fixed_lower_case:
- case __format_spec::__type::__fixed_upper_case:
- case __format_spec::__type::__general_lower_case:
- case __format_spec::__type::__general_upper_case:
- if (!__parser.__precision_as_arg_ && __parser.__precision_ == -1)
- // Set the default precision for the call to to_chars.
- __parser.__precision_ = 6;
- break;
-
- default:
- __format_spec::__throw_invalid_type_format_error(__id);
- }
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr void __process_display_type_pointer(__format_spec::__type __type, const char* __id) {
- switch (__type) {
- case __format_spec::__type::__default:
- case __format_spec::__type::__pointer_lower_case:
- case __format_spec::__type::__pointer_upper_case:
- break;
-
- default:
- __format_spec::__throw_invalid_type_format_error(__id);
- }
-}
-
-template <contiguous_iterator _Iterator>
-struct __column_width_result {
- /// The number of output columns.
- size_t __width_;
- /// One beyond the last code unit used in the estimation.
- ///
- /// This limits the original output to fit in the wanted number of columns.
- _Iterator __last_;
-};
-
-template <contiguous_iterator _Iterator>
-__column_width_result(size_t, _Iterator) -> __column_width_result<_Iterator>;
-
-/// Since a column width can be two it's possible that the requested column
-/// width can't be achieved. Depending on the intended usage the policy can be
-/// selected.
-/// - When used as precision the maximum width may not be exceeded and the
-/// result should be "rounded down" to the previous boundary.
-/// - When used as a width we're done once the minimum is reached, but
-/// exceeding is not an issue. Rounding down is an issue since that will
-/// result in writing fill characters. Therefore the result needs to be
-/// "rounded up".
-enum class __column_width_rounding { __down, __up };
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-
-namespace __detail {
-template <contiguous_iterator _Iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_Iterator> __estimate_column_width_grapheme_clustering(
- _Iterator __first, _Iterator __last, size_t __maximum, __column_width_rounding __rounding) noexcept {
- using _CharT = iter_value_t<_Iterator>;
- __unicode::__extended_grapheme_cluster_view<_CharT> __view{__first, __last};
-
- __column_width_result<_Iterator> __result{0, __first};
- while (__result.__last_ != __last && __result.__width_ <= __maximum) {
- typename __unicode::__extended_grapheme_cluster_view<_CharT>::__cluster __cluster = __view.__consume();
- int __width = __width_estimation_table::__estimated_width(__cluster.__code_point_);
-
- // When the next entry would exceed the maximum width the previous width
- // might be returned. For example when a width of 100 is requested the
- // returned width might be 99, since the next code point has an estimated
- // column width of 2. This depends on the rounding flag.
- // When the maximum is exceeded the loop will abort the next iteration.
- if (__rounding == __column_width_rounding::__down && __result.__width_ + __width > __maximum)
- return __result;
-
- __result.__width_ += __width;
- __result.__last_ = __cluster.__last_;
- }
-
- return __result;
-}
-
-} // namespace __detail
-
-// Unicode can be stored in several formats: UTF-8, UTF-16, and UTF-32.
-// Depending on format the relation between the number of code units stored and
-// the number of output columns differs. The first relation is the number of
-// code units forming a code point. (The text assumes the code units are
-// unsigned.)
-// - UTF-8 The number of code units is between one and four. The first 127
-// Unicode code points match the ASCII character set. When the highest bit is
-// set it means the code point has more than one code unit.
-// - UTF-16: The number of code units is between 1 and 2. When the first
-// code unit is in the range [0xd800,0xdfff) it means the code point uses two
-// code units.
-// - UTF-32: The number of code units is always one.
-//
-// The code point to the number of columns is specified in
-// [format.string.std]/11. This list might change in the future.
-//
-// Another thing to be taken into account is Grapheme clustering. This means
-// that in some cases multiple code points are combined one element in the
-// output. For example:
-// - an ASCII character with a combined diacritical mark
-// - an emoji with a skin tone modifier
-// - a group of combined people emoji to create a family
-// - a combination of flag emoji
-//
-// See also:
-// - [format.string.general]/11
-// - https://en.wikipedia.org/wiki/UTF-8#Encoding
-// - https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
-
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_ascii(char32_t __c) { return __c < 0x80; }
-
-/// Determines the number of output columns needed to render the input.
-///
-/// \note When the scanner encounters malformed Unicode it acts as-if every
-/// code unit is a one column code point. Typically a terminal uses the same
-/// strategy and replaces every malformed code unit with a one column
-/// replacement character.
-///
-/// \param __first Points to the first element of the input range.
-/// \param __last Points beyond the last element of the input range.
-/// \param __maximum The maximum number of output columns. The returned number
-/// of estimated output columns will not exceed this value.
-/// \param __rounding Selects the rounding method.
-/// \c __down result.__width_ <= __maximum
-/// \c __up result.__width_ <= __maximum + 1
-template <class _CharT, class _Iterator = typename basic_string_view<_CharT>::const_iterator>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_Iterator> __estimate_column_width(
- basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding __rounding) noexcept {
- // The width estimation is done in two steps:
- // - Quickly process for the ASCII part. ASCII has the following properties
- // - One code unit is one code point
- // - Every code point has an estimated width of one
- // - When needed it will a Unicode Grapheme clustering algorithm to find
- // the proper place for truncation.
-
- if (__str.empty() || __maximum == 0)
- return {0, __str.begin()};
-
- // ASCII has one caveat; when an ASCII character is followed by a non-ASCII
- // character they might be part of an extended grapheme cluster. For example:
- // an ASCII letter and a COMBINING ACUTE ACCENT
- // The truncate should happen after the COMBINING ACUTE ACCENT. Therefore we
- // need to scan one code unit beyond the requested precision. When this code
- // unit is non-ASCII we omit the current code unit and let the Grapheme
- // clustering algorithm do its work.
- auto __it = __str.begin();
- if (__format_spec::__is_ascii(*__it)) {
- do {
- --__maximum;
- ++__it;
- if (__it == __str.end())
- return {__str.size(), __str.end()};
-
- if (__maximum == 0) {
- if (__format_spec::__is_ascii(*__it))
- return {static_cast<size_t>(__it - __str.begin()), __it};
-
- break;
- }
- } while (__format_spec::__is_ascii(*__it));
- --__it;
- ++__maximum;
- }
-
- ptrdiff_t __ascii_size = __it - __str.begin();
- __column_width_result __result =
- __detail::__estimate_column_width_grapheme_clustering(__it, __str.end(), __maximum, __rounding);
-
- __result.__width_ += __ascii_size;
- return __result;
-}
-# else // !defined(_LIBCPP_HAS_NO_UNICODE)
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<typename basic_string_view<_CharT>::const_iterator>
-__estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding) noexcept {
- // When Unicode isn't supported assume ASCII and every code unit is one code
- // point. In ASCII the estimated column width is always one. Thus there's no
- // need for rounding.
- size_t __width = std::min(__str.size(), __maximum);
- return {__width, __str.begin() + __width};
-}
-
-# endif // !defined(_LIBCPP_HAS_NO_UNICODE)
-
-} // namespace __format_spec
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_PARSER_STD_FORMAT_SPEC_H
diff --git a/libcxx/include/__cxx03/__format/range_default_formatter.h b/libcxx/include/__cxx03/__format/range_default_formatter.h
deleted file mode 100644
index ca51a0f0a8227..0000000000000
--- a/libcxx/include/__cxx03/__format/range_default_formatter.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_RANGE_DEFAULT_FORMATTER_H
-#define _LIBCPP___CXX03___FORMAT_RANGE_DEFAULT_FORMATTER_H
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/range_formatter.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/string_view>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Rp, class _CharT>
-concept __const_formattable_range =
- ranges::input_range<const _Rp> && formattable<ranges::range_reference_t<const _Rp>, _CharT>;
-
-template <class _Rp, class _CharT>
-using __fmt_maybe_const = conditional_t<__const_formattable_range<_Rp, _CharT>, const _Rp, _Rp>;
-
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow")
-_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow")
-// This shadows map, set, and string.
-enum class range_format { disabled, map, set, sequence, string, debug_string };
-_LIBCPP_DIAGNOSTIC_POP
-
-// There is no definition of this struct, it's purely intended to be used to
-// generate diagnostics.
-template <class _Rp>
-struct _LIBCPP_TEMPLATE_VIS __instantiated_the_primary_template_of_format_kind;
-
-template <class _Rp>
-constexpr range_format format_kind = [] {
- // [format.range.fmtkind]/1
- // A program that instantiates the primary template of format_kind is ill-formed.
- static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type");
- return range_format::disabled;
-}();
-
-template <ranges::input_range _Rp>
- requires same_as<_Rp, remove_cvref_t<_Rp>>
-inline constexpr range_format format_kind<_Rp> = [] {
- // [format.range.fmtkind]/2
-
- // 2.1 If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R> is true,
- // Otherwise format_kind<R> is range_format::disabled.
- if constexpr (same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Rp>)
- return range_format::disabled;
- // 2.2 Otherwise, if the qualified-id R::key_type is valid and denotes a type:
- else if constexpr (requires { typename _Rp::key_type; }) {
- // 2.2.1 If the qualified-id R::mapped_type is valid and denotes a type ...
- if constexpr (requires { typename _Rp::mapped_type; } &&
- // 2.2.1 ... If either U is a specialization of pair or U is a specialization
- // of tuple and tuple_size_v<U> == 2
- __fmt_pair_like<remove_cvref_t<ranges::range_reference_t<_Rp>>>)
- return range_format::map;
- else
- // 2.2.2 Otherwise format_kind<R> is range_format::set.
- return range_format::set;
- } else
- // 2.3 Otherwise, format_kind<R> is range_format::sequence.
- return range_format::sequence;
-}();
-
-template <range_format _Kp, ranges::input_range _Rp, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __range_default_formatter;
-
-// Required specializations
-
-template <ranges::input_range _Rp, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::sequence, _Rp, _CharT> {
-private:
- using __maybe_const_r = __fmt_maybe_const<_Rp, _CharT>;
- range_formatter<remove_cvref_t<ranges::range_reference_t<__maybe_const_r>>, _CharT> __underlying_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept {
- __underlying_.set_separator(__separator);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void
- set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept {
- __underlying_.set_brackets(__opening_bracket, __closing_bracket);
- }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(__maybe_const_r& __range, _FormatContext& __ctx) const {
- return __underlying_.format(__range, __ctx);
- }
-};
-
-template <ranges::input_range _Rp, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::map, _Rp, _CharT> {
-private:
- using __maybe_const_map = __fmt_maybe_const<_Rp, _CharT>;
- using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_map>>;
- range_formatter<__element_type, _CharT> __underlying_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr __range_default_formatter()
- requires(__fmt_pair_like<__element_type>)
- {
- __underlying_.set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}"));
- __underlying_.underlying().set_brackets({}, {});
- __underlying_.underlying().set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": "));
- }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(__maybe_const_map& __range, _FormatContext& __ctx) const {
- return __underlying_.format(__range, __ctx);
- }
-};
-
-template <ranges::input_range _Rp, class _CharT>
-struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::set, _Rp, _CharT> {
-private:
- using __maybe_const_set = __fmt_maybe_const<_Rp, _CharT>;
- using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_set>>;
- range_formatter<__element_type, _CharT> __underlying_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr __range_default_formatter() {
- __underlying_.set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}"));
- }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __underlying_.parse(__ctx);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(__maybe_const_set& __range, _FormatContext& __ctx) const {
- return __underlying_.format(__range, __ctx);
- }
-};
-
-template <range_format _Kp, ranges::input_range _Rp, class _CharT>
- requires(_Kp == range_format::string || _Kp == range_format::debug_string)
-struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<_Kp, _Rp, _CharT> {
-private:
- // This deviates from the Standard, there the exposition only type is
- // formatter<basic_string<charT>, charT> underlying_;
- // Using a string_view allows the format function to avoid a copy of the
- // input range when it is a contigious range.
- formatter<basic_string_view<_CharT>, _CharT> __underlying_;
-
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- typename _ParseContext::iterator __i = __underlying_.parse(__ctx);
- if constexpr (_Kp == range_format::debug_string)
- __underlying_.set_debug_format();
- return __i;
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- format(conditional_t<ranges::input_range<const _Rp>, const _Rp&, _Rp&> __range, _FormatContext& __ctx) const {
- // When the range is contiguous use a basic_string_view instead to avoid a
- // copy of the underlying data. The basic_string_view formatter
- // specialization is the "basic" string formatter in libc++.
- if constexpr (ranges::contiguous_range<_Rp> && std::ranges::sized_range<_Rp>)
- return __underlying_.format(basic_string_view<_CharT>{ranges::data(__range), ranges::size(__range)}, __ctx);
- else
- return __underlying_.format(basic_string<_CharT>{from_range, __range}, __ctx);
- }
-};
-
-template <ranges::input_range _Rp, class _CharT>
- requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>)
-struct _LIBCPP_TEMPLATE_VIS formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {};
-
-#endif //_LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_RANGE_DEFAULT_FORMATTER_H
diff --git a/libcxx/include/__cxx03/__format/range_formatter.h b/libcxx/include/__cxx03/__format/range_formatter.h
deleted file mode 100644
index 0b6ee4401fc75..0000000000000
--- a/libcxx/include/__cxx03/__format/range_formatter.h
+++ /dev/null
@@ -1,264 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_RANGE_FORMATTER_H
-#define _LIBCPP___CXX03___FORMAT_RANGE_FORMATTER_H
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/buffer.h>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_context.h>
-#include <__cxx03/__format/format_error.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/string_view>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Tp, class _CharT = char>
- requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT>
-struct _LIBCPP_TEMPLATE_VIS range_formatter {
- _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept {
- __separator_ = __separator;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void
- set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept {
- __opening_bracket_ = __opening_bracket;
- __closing_bracket_ = __closing_bracket;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr formatter<_Tp, _CharT>& underlying() noexcept { return __underlying_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const formatter<_Tp, _CharT>& underlying() const noexcept { return __underlying_; }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- auto __begin = __parser_.__parse(__ctx, __format_spec::__fields_range);
- auto __end = __ctx.end();
- // Note the cases where __begin == __end in this code only happens when the
- // replacement-field has no terminating }, or when the parse is manually
- // called with a format-spec. The former is an error and the latter means
- // using a formatter without the format functions or print.
- if (__begin == __end) [[unlikely]]
- return __parse_empty_range_underlying_spec(__ctx, __begin);
-
- // The n field overrides a possible m type, therefore delay applying the
- // effect of n until the type has been procesed.
- __parse_type(__begin, __end);
- if (__parser_.__clear_brackets_)
- set_brackets({}, {});
- if (__begin == __end) [[unlikely]]
- return __parse_empty_range_underlying_spec(__ctx, __begin);
-
- bool __has_range_underlying_spec = *__begin == _CharT(':');
- if (__has_range_underlying_spec) {
- // range-underlying-spec:
- // : format-spec
- ++__begin;
- } else if (__begin != __end && *__begin != _CharT('}'))
- // When there is no underlaying range the current parse should have
- // consumed the format-spec. If not, the not consumed input will be
- // processed by the underlying. For example {:-} for a range in invalid,
- // the sign field is not present. Without this check the underlying_ will
- // get -} as input which my be valid.
- std::__throw_format_error("The format specifier should consume the input or end with a '}'");
-
- __ctx.advance_to(__begin);
- __begin = __underlying_.parse(__ctx);
-
- // This test should not be required if __has_range_underlying_spec is false.
- // However this test makes sure the underlying formatter left the parser in
- // a valid state. (Note this is not a full protection against evil parsers.
- // For example
- // } this is test for the next argument {}
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
- // could consume more than it should.
- if (__begin != __end && *__begin != _CharT('}'))
- std::__throw_format_error("The format specifier should consume the input or end with a '}'");
-
- if (__parser_.__type_ != __format_spec::__type::__default) {
- // [format.range.formatter]/6
- // If the range-type is s or ?s, then there shall be no n option and no
- // range-underlying-spec.
- if (__parser_.__clear_brackets_) {
- if (__parser_.__type_ == __format_spec::__type::__string)
- std::__throw_format_error("The n option and type s can't be used together");
- std::__throw_format_error("The n option and type ?s can't be used together");
- }
- if (__has_range_underlying_spec) {
- if (__parser_.__type_ == __format_spec::__type::__string)
- std::__throw_format_error("Type s and an underlying format specification can't be used together");
- std::__throw_format_error("Type ?s and an underlying format specification can't be used together");
- }
- } else if (!__has_range_underlying_spec)
- std::__set_debug_format(__underlying_);
-
- return __begin;
- }
-
- template <ranges::input_range _Rp, class _FormatContext>
- requires formattable<ranges::range_reference_t<_Rp>, _CharT> &&
- same_as<remove_cvref_t<ranges::range_reference_t<_Rp>>, _Tp>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_Rp&& __range, _FormatContext& __ctx) const {
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
-
- if (!__specs.__has_width())
- return __format_range(__range, __ctx, __specs);
-
- // The size of the buffer needed is:
- // - open bracket characters
- // - close bracket character
- // - n elements where every element may have a different size
- // - (n -1) separators
- // The size of the element is hard to predict, knowing the type helps but
- // it depends on the format-spec. As an initial estimate we guess 6
- // characters.
- // Typically both brackets are 1 character and the separator is 2
- // characters. Which means there will be
- // (n - 1) * 2 + 1 + 1 = n * 2 character
- // So estimate 8 times the range size as buffer.
- std::size_t __capacity_hint = 0;
- if constexpr (std::ranges::sized_range<_Rp>)
- __capacity_hint = 8 * ranges::size(__range);
- __format::__retarget_buffer<_CharT> __buffer{__capacity_hint};
- basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> __c{
- __buffer.__make_output_iterator(), __ctx};
-
- __format_range(__range, __c, __specs);
-
- return __formatter::__write_string_no_precision(__buffer.__view(), __ctx.out(), __specs);
- }
-
- template <ranges::input_range _Rp, class _FormatContext>
- typename _FormatContext::iterator _LIBCPP_HIDE_FROM_ABI
- __format_range(_Rp&& __range, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) const {
- if constexpr (same_as<_Tp, _CharT>) {
- switch (__specs.__std_.__type_) {
- case __format_spec::__type::__string:
- case __format_spec::__type::__debug:
- return __format_as_string(__range, __ctx, __specs.__std_.__type_ == __format_spec::__type::__debug);
- default:
- return __format_as_sequence(__range, __ctx);
- }
- } else
- return __format_as_sequence(__range, __ctx);
- }
-
- template <ranges::input_range _Rp, class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- __format_as_string(_Rp&& __range, _FormatContext& __ctx, bool __debug_format) const {
- // When the range is contiguous use a basic_string_view instead to avoid a
- // copy of the underlying data. The basic_string_view formatter
- // specialization is the "basic" string formatter in libc++.
- if constexpr (ranges::contiguous_range<_Rp> && std::ranges::sized_range<_Rp>) {
- std::formatter<basic_string_view<_CharT>, _CharT> __formatter;
- if (__debug_format)
- __formatter.set_debug_format();
- return __formatter.format(
- basic_string_view<_CharT>{
- ranges::data(__range),
- ranges::size(__range),
- },
- __ctx);
- } else {
- std::formatter<basic_string<_CharT>, _CharT> __formatter;
- if (__debug_format)
- __formatter.set_debug_format();
- return __formatter.format(basic_string<_CharT>{from_range, __range}, __ctx);
- }
- }
-
- template <ranges::input_range _Rp, class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
- __format_as_sequence(_Rp&& __range, _FormatContext& __ctx) const {
- __ctx.advance_to(ranges::copy(__opening_bracket_, __ctx.out()).out);
- bool __use_separator = false;
- for (auto&& __e : __range) {
- if (__use_separator)
- __ctx.advance_to(ranges::copy(__separator_, __ctx.out()).out);
- else
- __use_separator = true;
-
- __ctx.advance_to(__underlying_.format(__e, __ctx));
- }
-
- return ranges::copy(__closing_bracket_, __ctx.out()).out;
- }
-
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left};
-
-private:
- template <contiguous_iterator _Iterator>
- _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(_Iterator& __begin, _Iterator __end) {
- switch (*__begin) {
- case _CharT('m'):
- if constexpr (__fmt_pair_like<_Tp>) {
- set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}"));
- set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", "));
- ++__begin;
- } else
- std::__throw_format_error("Type m requires a pair or a tuple with two elements");
- break;
-
- case _CharT('s'):
- if constexpr (same_as<_Tp, _CharT>) {
- __parser_.__type_ = __format_spec::__type::__string;
- ++__begin;
- } else
- std::__throw_format_error("Type s requires character type as formatting argument");
- break;
-
- case _CharT('?'):
- ++__begin;
- if (__begin == __end || *__begin != _CharT('s'))
- std::__throw_format_error("The format specifier should consume the input or end with a '}'");
- if constexpr (same_as<_Tp, _CharT>) {
- __parser_.__type_ = __format_spec::__type::__debug;
- ++__begin;
- } else
- std::__throw_format_error("Type ?s requires character type as formatting argument");
- }
- }
-
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator
- __parse_empty_range_underlying_spec(_ParseContext& __ctx, typename _ParseContext::iterator __begin) {
- __ctx.advance_to(__begin);
- [[maybe_unused]] typename _ParseContext::iterator __result = __underlying_.parse(__ctx);
- _LIBCPP_ASSERT_INTERNAL(__result == __begin,
- "the underlying's parse function should not advance the input beyond the end of the input");
- return __begin;
- }
-
- formatter<_Tp, _CharT> __underlying_;
- basic_string_view<_CharT> __separator_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ", ");
- basic_string_view<_CharT> __opening_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "[");
- basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]");
-};
-
-#endif //_LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_RANGE_FORMATTER_H
diff --git a/libcxx/include/__cxx03/__format/unicode.h b/libcxx/include/__cxx03/__format/unicode.h
deleted file mode 100644
index e6e9b895df9a7..0000000000000
--- a/libcxx/include/__cxx03/__format/unicode.h
+++ /dev/null
@@ -1,602 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_UNICODE_H
-#define _LIBCPP___CXX03___FORMAT_UNICODE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/countl.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/extended_grapheme_cluster_table.h>
-#include <__cxx03/__format/indic_conjunct_break_table.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/readable_traits.h> // iter_value_t
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __unicode {
-
-// Helper struct for the result of a consume operation.
-//
-// The status value for a correct code point is 0. This allows a valid value to
-// be used without masking.
-// When the decoding fails it know the number of code units affected. For the
-// current use-cases that value is not needed, therefore it is not stored.
-// The escape routine needs the number of code units for both a valid and
-// invalid character and keeps track of it itself. Doing it in this result
-// unconditionally would give some overhead when the value is unneeded.
-struct __consume_result {
- // When __status == __ok it contains the decoded code point.
- // Else it contains the replacement character U+FFFD
- char32_t __code_point : 31;
-
- enum : char32_t {
- // Consumed a well-formed code point.
- __ok = 0,
- // Encountered invalid UTF-8
- __error = 1
- } __status : 1 {__ok};
-};
-static_assert(sizeof(__consume_result) == sizeof(char32_t));
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-
-/// Implements the grapheme cluster boundary rules
-///
-/// These rules are used to implement format's width estimation as stated in
-/// [format.string.std]/11
-///
-/// The Standard refers to UAX \#29 for Unicode 12.0.0
-/// https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules
-///
-/// The data tables used are
-/// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
-/// https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
-/// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt (for testing only)
-
-inline constexpr char32_t __replacement_character = U'\ufffd';
-
-// The error of a consume operation.
-//
-// This sets the code point to the replacement character. This code point does
-// not participate in the grapheme clustering, so grapheme clustering code can
-// ignore the error status and always use the code point.
-inline constexpr __consume_result __consume_result_error{__replacement_character, __consume_result::__error};
-
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_high_surrogate(char32_t __value) {
- return __value >= 0xd800 && __value <= 0xdbff;
-}
-
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_low_surrogate(char32_t __value) {
- return __value >= 0xdc00 && __value <= 0xdfff;
-}
-
-// https://www.unicode.org/glossary/#surrogate_code_point
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_surrogate(char32_t __value) {
- return __value >= 0xd800 && __value <= 0xdfff;
-}
-
-// https://www.unicode.org/glossary/#code_point
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_code_point(char32_t __value) {
- return __value <= 0x10ffff;
-}
-
-// https://www.unicode.org/glossary/#unicode_scalar_value
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_scalar_value(char32_t __value) {
- return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value);
-}
-
-template <contiguous_iterator _Iterator>
- requires same_as<iter_value_t<_Iterator>, char>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(_Iterator __char, int __count) {
- do {
- if ((*__char & 0b1100'0000) != 0b1000'0000)
- return false;
- --__count;
- ++__char;
- } while (__count);
- return true;
-}
-
-/// Helper class to extract a code unit from a Unicode character range.
-///
-/// The stored range is a view. There are multiple specialization for different
-/// character types.
-template <class _CharT>
-class __code_point_view;
-
-/// UTF-8 specialization.
-template <>
-class __code_point_view<char> {
- using _Iterator = basic_string_view<char>::const_iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last)
- : __first_(__first), __last_(__last) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; }
-
- // https://www.unicode.org/versions/latest/ch03.pdf#G7404
- // Based on Table 3-7, Well-Formed UTF-8 Byte Sequences
- //
- // Code Points First Byte Second Byte Third Byte Fourth Byte Remarks
- // U+0000..U+007F 00..7F U+0000..U+007F 1 code unit range
- // C0..C1 80..BF invalid overlong encoding
- // U+0080..U+07FF C2..DF 80..BF U+0080..U+07FF 2 code unit range
- // E0 80..9F 80..BF invalid overlong encoding
- // U+0800..U+0FFF E0 A0..BF 80..BF U+0800..U+FFFF 3 code unit range
- // U+1000..U+CFFF E1..EC 80..BF 80..BF
- // U+D000..U+D7FF ED 80..9F 80..BF
- // U+D800..U+DFFF ED A0..BF 80..BF invalid encoding of surrogate code point
- // U+E000..U+FFFF EE..EF 80..BF 80..BF
- // F0 80..8F 80..BF 80..BF invalid overlong encoding
- // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF U+10000..U+10FFFF 4 code unit range
- // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
- // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
- // F4 90..BF 80..BF 80..BF U+110000.. invalid code point range
- //
- // Unlike other parsers, these invalid entries are tested after decoding.
- // - The parser always needs to consume these code units
- // - The code is optimized for well-formed UTF-8
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept {
- _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input");
-
- // Based on the number of leading 1 bits the number of code units in the
- // code point can be determined. See
- // https://en.wikipedia.org/wiki/UTF-8#Encoding
- switch (std::countl_one(static_cast<unsigned char>(*__first_))) {
- case 0:
- return {static_cast<unsigned char>(*__first_++)};
-
- case 2: {
- if (__last_ - __first_ < 2 || !__unicode::__is_continuation(__first_ + 1, 1)) [[unlikely]]
- break;
-
- char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
-
- // These values should be encoded in 1 UTF-8 code unit.
- if (__value < 0x0080) [[unlikely]]
- return __consume_result_error;
-
- return {__value};
- }
-
- case 3: {
- if (__last_ - __first_ < 3 || !__unicode::__is_continuation(__first_ + 1, 2)) [[unlikely]]
- break;
-
- char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
-
- // These values should be encoded in 1 or 2 UTF-8 code units.
- if (__value < 0x0800) [[unlikely]]
- return __consume_result_error;
-
- // A surrogate value is always encoded in 3 UTF-8 code units.
- if (__unicode::__is_surrogate(__value)) [[unlikely]]
- return __consume_result_error;
-
- return {__value};
- }
-
- case 4: {
- if (__last_ - __first_ < 4 || !__unicode::__is_continuation(__first_ + 1, 3)) [[unlikely]]
- break;
-
- char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
- __value <<= 6;
- __value |= static_cast<unsigned char>(*__first_++) & 0x3f;
-
- // These values should be encoded in 1, 2, or 3 UTF-8 code units.
- if (__value < 0x10000) [[unlikely]]
- return __consume_result_error;
-
- // A value too large is always encoded in 4 UTF-8 code units.
- if (!__unicode::__is_code_point(__value)) [[unlikely]]
- return __consume_result_error;
-
- return {__value};
- }
- }
- // An invalid number of leading ones can be garbage or a code unit in the
- // middle of a code point. By consuming one code unit the parser may get
- // "in sync" after a few code units.
- ++__first_;
- return __consume_result_error;
- }
-
-private:
- _Iterator __first_;
- _Iterator __last_;
-};
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate_pair_high(wchar_t __value) {
- return __value >= 0xd800 && __value <= 0xdbff;
-}
-
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate_pair_low(wchar_t __value) {
- return __value >= 0xdc00 && __value <= 0xdfff;
-}
-
-/// This specialization depends on the size of wchar_t
-/// - 2 UTF-16 (for example Windows and AIX)
-/// - 4 UTF-32 (for example Linux)
-template <>
-class __code_point_view<wchar_t> {
- using _Iterator = typename basic_string_view<wchar_t>::const_iterator;
-
-public:
- static_assert(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4, "sizeof(wchar_t) has a not implemented value");
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last)
- : __first_(__first), __last_(__last) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; }
- _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept {
- _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input");
-
- char32_t __value = static_cast<char32_t>(*__first_++);
- if constexpr (sizeof(wchar_t) == 2) {
- if (__unicode::__is_low_surrogate(__value)) [[unlikely]]
- return __consume_result_error;
-
- if (__unicode::__is_high_surrogate(__value)) {
- if (__first_ == __last_ || !__unicode::__is_low_surrogate(static_cast<char32_t>(*__first_))) [[unlikely]]
- return __consume_result_error;
-
- __value -= 0xd800;
- __value <<= 10;
- __value += static_cast<char32_t>(*__first_++) - 0xdc00;
- __value += 0x10000;
-
- if (!__unicode::__is_code_point(__value)) [[unlikely]]
- return __consume_result_error;
- }
- } else {
- if (!__unicode::__is_scalar_value(__value)) [[unlikely]]
- return __consume_result_error;
- }
-
- return {__value};
- }
-
-private:
- _Iterator __first_;
- _Iterator __last_;
-};
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-// State machine to implement the Extended Grapheme Cluster Boundary
-//
-// The exact rules may change between Unicode versions.
-// This implements the extended rules see
-// https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
-class __extended_grapheme_cluster_break {
- using __EGC_property = __extended_grapheme_custer_property_boundary::__property;
- using __inCB_property = __indic_conjunct_break::__property;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __extended_grapheme_cluster_break(char32_t __first_code_point)
- : __prev_code_point_(__first_code_point),
- __prev_property_(__extended_grapheme_custer_property_boundary::__get_property(__first_code_point)) {
- // Initializes the active rule.
- if (__prev_property_ == __EGC_property::__Extended_Pictographic)
- __active_rule_ = __rule::__GB11_emoji;
- else if (__prev_property_ == __EGC_property::__Regional_Indicator)
- __active_rule_ = __rule::__GB12_GB13_regional_indicator;
- else if (__indic_conjunct_break::__get_property(__first_code_point) == __inCB_property::__Consonant)
- __active_rule_ = __rule::__GB9c_indic_conjunct_break;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(char32_t __next_code_point) {
- __EGC_property __next_property = __extended_grapheme_custer_property_boundary::__get_property(__next_code_point);
- bool __result = __evaluate(__next_code_point, __next_property);
- __prev_code_point_ = __next_code_point;
- __prev_property_ = __next_property;
- return __result;
- }
-
- // The code point whose break propery are considered during the next
- // evaluation cyle.
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr char32_t __current_code_point() const { return __prev_code_point_; }
-
-private:
- // The naming of the identifiers matches the Unicode standard.
- // NOLINTBEGIN(readability-identifier-naming)
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- __evaluate(char32_t __next_code_point, __EGC_property __next_property) {
- switch (__active_rule_) {
- case __rule::__none:
- return __evaluate_none(__next_code_point, __next_property);
- case __rule::__GB9c_indic_conjunct_break:
- return __evaluate_GB9c_indic_conjunct_break(__next_code_point, __next_property);
- case __rule::__GB11_emoji:
- return __evaluate_GB11_emoji(__next_code_point, __next_property);
- case __rule::__GB12_GB13_regional_indicator:
- return __evaluate_GB12_GB13_regional_indicator(__next_code_point, __next_property);
- }
- __libcpp_unreachable();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __evaluate_none(char32_t __next_code_point, __EGC_property __next_property) {
- // *** Break at the start and end of text, unless the text is empty. ***
-
- _LIBCPP_ASSERT_INTERNAL(__prev_property_ != __EGC_property::__sot, "should be handled in the constructor"); // GB1
- _LIBCPP_ASSERT_INTERNAL(__prev_property_ != __EGC_property::__eot, "should be handled by our caller"); // GB2
-
- // *** Do not break between a CR and LF. Otherwise, break before and after controls. ***
- if (__prev_property_ == __EGC_property::__CR && __next_property == __EGC_property::__LF) // GB3
- return false;
-
- if (__prev_property_ == __EGC_property::__Control || __prev_property_ == __EGC_property::__CR ||
- __prev_property_ == __EGC_property::__LF) // GB4
- return true;
-
- if (__next_property == __EGC_property::__Control || __next_property == __EGC_property::__CR ||
- __next_property == __EGC_property::__LF) // GB5
- return true;
-
- // *** Do not break Hangul syllable sequences. ***
- if (__prev_property_ == __EGC_property::__L &&
- (__next_property == __EGC_property::__L || __next_property == __EGC_property::__V ||
- __next_property == __EGC_property::__LV || __next_property == __EGC_property::__LVT)) // GB6
- return false;
-
- if ((__prev_property_ == __EGC_property::__LV || __prev_property_ == __EGC_property::__V) &&
- (__next_property == __EGC_property::__V || __next_property == __EGC_property::__T)) // GB7
- return false;
-
- if ((__prev_property_ == __EGC_property::__LVT || __prev_property_ == __EGC_property::__T) &&
- __next_property == __EGC_property::__T) // GB8
- return false;
-
- // *** Do not break before extending characters or ZWJ. ***
- if (__next_property == __EGC_property::__Extend || __next_property == __EGC_property::__ZWJ)
- return false; // GB9
-
- // *** Do not break before SpacingMarks, or after Prepend characters. ***
- if (__next_property == __EGC_property::__SpacingMark) // GB9a
- return false;
-
- if (__prev_property_ == __EGC_property::__Prepend) // GB9b
- return false;
-
- // *** Do not break within certain combinations with Indic_Conjunct_Break (InCB)=Linker. ***
- if (__indic_conjunct_break::__get_property(__next_code_point) == __inCB_property::__Consonant) {
- __active_rule_ = __rule::__GB9c_indic_conjunct_break;
- __GB9c_indic_conjunct_break_state_ = __GB9c_indic_conjunct_break_state::__Consonant;
- return true;
- }
-
- // *** Do not break within emoji modifier sequences or emoji zwj sequences. ***
- if (__next_property == __EGC_property::__Extended_Pictographic) {
- __active_rule_ = __rule::__GB11_emoji;
- __GB11_emoji_state_ = __GB11_emoji_state::__Extended_Pictographic;
- return true;
- }
-
- // *** Do not break within emoji flag sequences ***
-
- // That is, do not break between regional indicator (RI) symbols if there
- // is an odd number of RI characters before the break point.
- if (__next_property == __EGC_property::__Regional_Indicator) { // GB12 + GB13
- __active_rule_ = __rule::__GB12_GB13_regional_indicator;
- return true;
- }
-
- // *** Otherwise, break everywhere. ***
- return true; // GB999
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- __evaluate_GB9c_indic_conjunct_break(char32_t __next_code_point, __EGC_property __next_property) {
- __inCB_property __break = __indic_conjunct_break::__get_property(__next_code_point);
- if (__break == __inCB_property::__none) {
- __active_rule_ = __rule::__none;
- return __evaluate_none(__next_code_point, __next_property);
- }
-
- switch (__GB9c_indic_conjunct_break_state_) {
- case __GB9c_indic_conjunct_break_state::__Consonant:
- if (__break == __inCB_property::__Extend) {
- return false;
- }
- if (__break == __inCB_property::__Linker) {
- __GB9c_indic_conjunct_break_state_ = __GB9c_indic_conjunct_break_state::__Linker;
- return false;
- }
- __active_rule_ = __rule::__none;
- return __evaluate_none(__next_code_point, __next_property);
-
- case __GB9c_indic_conjunct_break_state::__Linker:
- if (__break == __inCB_property::__Extend) {
- return false;
- }
- if (__break == __inCB_property::__Linker) {
- return false;
- }
- if (__break == __inCB_property::__Consonant) {
- __GB9c_indic_conjunct_break_state_ = __GB9c_indic_conjunct_break_state::__Consonant;
- return false;
- }
- __active_rule_ = __rule::__none;
- return __evaluate_none(__next_code_point, __next_property);
- }
- __libcpp_unreachable();
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- __evaluate_GB11_emoji(char32_t __next_code_point, __EGC_property __next_property) {
- switch (__GB11_emoji_state_) {
- case __GB11_emoji_state::__Extended_Pictographic:
- if (__next_property == __EGC_property::__Extend) {
- __GB11_emoji_state_ = __GB11_emoji_state::__Extend;
- return false;
- }
- [[fallthrough]];
- case __GB11_emoji_state::__Extend:
- if (__next_property == __EGC_property::__ZWJ) {
- __GB11_emoji_state_ = __GB11_emoji_state::__ZWJ;
- return false;
- }
- if (__next_property == __EGC_property::__Extend)
- return false;
- __active_rule_ = __rule::__none;
- return __evaluate_none(__next_code_point, __next_property);
-
- case __GB11_emoji_state::__ZWJ:
- if (__next_property == __EGC_property::__Extended_Pictographic) {
- __GB11_emoji_state_ = __GB11_emoji_state::__Extended_Pictographic;
- return false;
- }
- __active_rule_ = __rule::__none;
- return __evaluate_none(__next_code_point, __next_property);
- }
- __libcpp_unreachable();
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool
- __evaluate_GB12_GB13_regional_indicator(char32_t __next_code_point, __EGC_property __next_property) {
- __active_rule_ = __rule::__none;
- if (__next_property == __EGC_property::__Regional_Indicator)
- return false;
- return __evaluate_none(__next_code_point, __next_property);
- }
-
- char32_t __prev_code_point_;
- __EGC_property __prev_property_;
-
- enum class __rule {
- __none,
- __GB9c_indic_conjunct_break,
- __GB11_emoji,
- __GB12_GB13_regional_indicator,
- };
- __rule __active_rule_ = __rule::__none;
-
- enum class __GB11_emoji_state {
- __Extended_Pictographic,
- __Extend,
- __ZWJ,
- };
- __GB11_emoji_state __GB11_emoji_state_ = __GB11_emoji_state::__Extended_Pictographic;
-
- enum class __GB9c_indic_conjunct_break_state {
- __Consonant,
- __Linker,
- };
-
- __GB9c_indic_conjunct_break_state __GB9c_indic_conjunct_break_state_ = __GB9c_indic_conjunct_break_state::__Consonant;
-
- // NOLINTEND(readability-identifier-naming)
-};
-
-/// Helper class to extract an extended grapheme cluster from a Unicode character range.
-///
-/// This function is used to determine the column width of an extended grapheme
-/// cluster. In order to do that only the first code point is evaluated.
-/// Therefore only this code point is extracted.
-template <class _CharT>
-class __extended_grapheme_cluster_view {
- using _Iterator = typename basic_string_view<_CharT>::const_iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __extended_grapheme_cluster_view(_Iterator __first, _Iterator __last)
- : __code_point_view_(__first, __last), __at_break_(__code_point_view_.__consume().__code_point) {}
-
- struct __cluster {
- /// The first code point of the extended grapheme cluster.
- ///
- /// The first code point is used to estimate the width of the extended
- /// grapheme cluster.
- char32_t __code_point_;
-
- /// Points one beyond the last code unit in the extended grapheme cluster.
- ///
- /// It's expected the caller has the start position and thus can determine
- /// the code unit range of the extended grapheme cluster.
- _Iterator __last_;
- };
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() {
- char32_t __code_point = __at_break_.__current_code_point();
- _Iterator __position = __code_point_view_.__position();
- while (!__code_point_view_.__at_end()) {
- if (__at_break_(__code_point_view_.__consume().__code_point))
- break;
- __position = __code_point_view_.__position();
- }
- return {__code_point, __position};
- }
-
-private:
- __code_point_view<_CharT> __code_point_view_;
- __extended_grapheme_cluster_break __at_break_;
-};
-
-template <contiguous_iterator _Iterator>
-__extended_grapheme_cluster_view(_Iterator, _Iterator) -> __extended_grapheme_cluster_view<iter_value_t<_Iterator>>;
-
-# else // _LIBCPP_HAS_NO_UNICODE
-
-// For ASCII every character is a "code point".
-// This makes it easier to write code agnostic of the _LIBCPP_HAS_NO_UNICODE define.
-template <class _CharT>
-class __code_point_view {
- using _Iterator = typename basic_string_view<_CharT>::const_iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last)
- : __first_(__first), __last_(__last) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept {
- _LIBCPP_ASSERT_INTERNAL(__first_ != __last_, "can't move beyond the end of input");
- return {static_cast<char32_t>(*__first_++)};
- }
-
-private:
- _Iterator __first_;
- _Iterator __last_;
-};
-
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-} // namespace __unicode
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_UNICODE_H
diff --git a/libcxx/include/__cxx03/__format/width_estimation_table.h b/libcxx/include/__cxx03/__format/width_estimation_table.h
deleted file mode 100644
index 0929c4bbf0f09..0000000000000
--- a/libcxx/include/__cxx03/__format/width_estimation_table.h
+++ /dev/null
@@ -1,270 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// WARNING, this entire header is generated by
-// utils/generate_width_estimation_table.py
-// DO NOT MODIFY!
-
-// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-//
-// See Terms of Use <https://www.unicode.org/copyright.html>
-// for definitions of Unicode Inc.'s Data Files and Software.
-//
-// NOTICE TO USER: Carefully read the following legal agreement.
-// BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
-// DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
-// YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
-// TERMS AND CONDITIONS OF THIS AGREEMENT.
-// IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
-// THE DATA FILES OR SOFTWARE.
-//
-// COPYRIGHT AND PERMISSION NOTICE
-//
-// Copyright (c) 1991-2022 Unicode, Inc. All rights reserved.
-// Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of the Unicode data files and any associated documentation
-// (the "Data Files") or Unicode software and any associated documentation
-// (the "Software") to deal in the Data Files or Software
-// without restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, and/or sell copies of
-// the Data Files or Software, and to permit persons to whom the Data Files
-// or Software are furnished to do so, provided that either
-// (a) this copyright and permission notice appear with all copies
-// of the Data Files or Software, or
-// (b) this copyright and permission notice appear in associated
-// Documentation.
-//
-// THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-// NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-// DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-//
-// Except as contained in this notice, the name of a copyright holder
-// shall not be used in advertising or otherwise to promote the sale,
-// use or other dealings in these Data Files or Software without prior
-// written authorization of the copyright holder.
-
-#ifndef _LIBCPP___CXX03___FORMAT_WIDTH_ESTIMATION_TABLE_H
-#define _LIBCPP___CXX03___FORMAT_WIDTH_ESTIMATION_TABLE_H
-
-#include <__cxx03/__algorithm/ranges_upper_bound.h>
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace __width_estimation_table {
-
-/// The entries of the characters with an estimated width of 2.
-///
-/// Contains the entries for [format.string.std]/12
-/// - Any code point with the East_Asian_Width="W" or East_Asian_Width="F"
-/// Derived Extracted Property as described by UAX #44
-/// - U+4DC0 - U+4DFF (Yijing Hexagram Symbols)
-/// - U+1F300 - U+1F5FF (Miscellaneous Symbols and Pictographs)
-/// - U+1F900 - U+1F9FF (Supplemental Symbols and Pictographs)
-///
-/// The data is generated from
-/// - https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
-/// - The "overrides" in [format.string.std]/12
-///
-/// The format of EastAsianWidth.txt is two fields separated by a semicolon.
-/// Field 0: Unicode code point value or range of code point values
-/// Field 1: East_Asian_Width property, consisting of one of the following values:
-/// "A", "F", "H", "N", "Na", "W"
-/// - All code points, assigned or unassigned, that are not listed
-/// explicitly are given the value "N".
-/// - The unassigned code points in the following blocks default to "W":
-/// CJK Unified Ideographs Extension A: U+3400..U+4DBF
-/// CJK Unified Ideographs: U+4E00..U+9FFF
-/// CJK Compatibility Ideographs: U+F900..U+FAFF
-/// - All undesignated code points in Planes 2 and 3, whether inside or
-/// outside of allocated blocks, default to "W":
-/// Plane 2: U+20000..U+2FFFD
-/// Plane 3: U+30000..U+3FFFD
-///
-/// The table is similar to the table
-/// __extended_grapheme_custer_property_boundary::__entries
-/// which explains the details of these classes. The only difference is this
-/// table lacks a property, thus having more bits available for the size.
-///
-/// The maximum code point that has an estimated width of 2 is U+3FFFD. This
-/// value can be encoded in 18 bits. Thus the upper 3 bits of the code point
-/// are always 0. These 3 bits are used to enlarge the offset range. This
-/// optimization reduces the table in Unicode 15 from 184 to 104 entries,
-/// saving 320 bytes.
-///
-/// The data has 2 values:
-/// - bits [0, 13] The size of the range, allowing 16384 elements.
-/// - bits [14, 31] The lower bound code point of the range. The upper bound of
-/// the range is lower bound + size.
-_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[107] = {
- 0x0440005f /* 00001100 - 0000115f [ 96] */, //
- 0x08c68001 /* 0000231a - 0000231b [ 2] */, //
- 0x08ca4001 /* 00002329 - 0000232a [ 2] */, //
- 0x08fa4003 /* 000023e9 - 000023ec [ 4] */, //
- 0x08fc0000 /* 000023f0 - 000023f0 [ 1] */, //
- 0x08fcc000 /* 000023f3 - 000023f3 [ 1] */, //
- 0x097f4001 /* 000025fd - 000025fe [ 2] */, //
- 0x09850001 /* 00002614 - 00002615 [ 2] */, //
- 0x0992000b /* 00002648 - 00002653 [ 12] */, //
- 0x099fc000 /* 0000267f - 0000267f [ 1] */, //
- 0x09a4c000 /* 00002693 - 00002693 [ 1] */, //
- 0x09a84000 /* 000026a1 - 000026a1 [ 1] */, //
- 0x09aa8001 /* 000026aa - 000026ab [ 2] */, //
- 0x09af4001 /* 000026bd - 000026be [ 2] */, //
- 0x09b10001 /* 000026c4 - 000026c5 [ 2] */, //
- 0x09b38000 /* 000026ce - 000026ce [ 1] */, //
- 0x09b50000 /* 000026d4 - 000026d4 [ 1] */, //
- 0x09ba8000 /* 000026ea - 000026ea [ 1] */, //
- 0x09bc8001 /* 000026f2 - 000026f3 [ 2] */, //
- 0x09bd4000 /* 000026f5 - 000026f5 [ 1] */, //
- 0x09be8000 /* 000026fa - 000026fa [ 1] */, //
- 0x09bf4000 /* 000026fd - 000026fd [ 1] */, //
- 0x09c14000 /* 00002705 - 00002705 [ 1] */, //
- 0x09c28001 /* 0000270a - 0000270b [ 2] */, //
- 0x09ca0000 /* 00002728 - 00002728 [ 1] */, //
- 0x09d30000 /* 0000274c - 0000274c [ 1] */, //
- 0x09d38000 /* 0000274e - 0000274e [ 1] */, //
- 0x09d4c002 /* 00002753 - 00002755 [ 3] */, //
- 0x09d5c000 /* 00002757 - 00002757 [ 1] */, //
- 0x09e54002 /* 00002795 - 00002797 [ 3] */, //
- 0x09ec0000 /* 000027b0 - 000027b0 [ 1] */, //
- 0x09efc000 /* 000027bf - 000027bf [ 1] */, //
- 0x0ac6c001 /* 00002b1b - 00002b1c [ 2] */, //
- 0x0ad40000 /* 00002b50 - 00002b50 [ 1] */, //
- 0x0ad54000 /* 00002b55 - 00002b55 [ 1] */, //
- 0x0ba00019 /* 00002e80 - 00002e99 [ 26] */, //
- 0x0ba6c058 /* 00002e9b - 00002ef3 [ 89] */, //
- 0x0bc000d5 /* 00002f00 - 00002fd5 [ 214] */, //
- 0x0bfc004e /* 00002ff0 - 0000303e [ 79] */, //
- 0x0c104055 /* 00003041 - 00003096 [ 86] */, //
- 0x0c264066 /* 00003099 - 000030ff [ 103] */, //
- 0x0c41402a /* 00003105 - 0000312f [ 43] */, //
- 0x0c4c405d /* 00003131 - 0000318e [ 94] */, //
- 0x0c640053 /* 00003190 - 000031e3 [ 84] */, //
- 0x0c7bc02f /* 000031ef - 0000321e [ 48] */, //
- 0x0c880027 /* 00003220 - 00003247 [ 40] */, //
- 0x0c943fff /* 00003250 - 0000724f [16384] */, //
- 0x1c94323c /* 00007250 - 0000a48c [12861] */, //
- 0x29240036 /* 0000a490 - 0000a4c6 [ 55] */, //
- 0x2a58001c /* 0000a960 - 0000a97c [ 29] */, //
- 0x2b002ba3 /* 0000ac00 - 0000d7a3 [11172] */, //
- 0x3e4001ff /* 0000f900 - 0000faff [ 512] */, //
- 0x3f840009 /* 0000fe10 - 0000fe19 [ 10] */, //
- 0x3f8c0022 /* 0000fe30 - 0000fe52 [ 35] */, //
- 0x3f950012 /* 0000fe54 - 0000fe66 [ 19] */, //
- 0x3f9a0003 /* 0000fe68 - 0000fe6b [ 4] */, //
- 0x3fc0405f /* 0000ff01 - 0000ff60 [ 96] */, //
- 0x3ff80006 /* 0000ffe0 - 0000ffe6 [ 7] */, //
- 0x5bf80004 /* 00016fe0 - 00016fe4 [ 5] */, //
- 0x5bfc0001 /* 00016ff0 - 00016ff1 [ 2] */, //
- 0x5c0017f7 /* 00017000 - 000187f7 [ 6136] */, //
- 0x620004d5 /* 00018800 - 00018cd5 [ 1238] */, //
- 0x63400008 /* 00018d00 - 00018d08 [ 9] */, //
- 0x6bfc0003 /* 0001aff0 - 0001aff3 [ 4] */, //
- 0x6bfd4006 /* 0001aff5 - 0001affb [ 7] */, //
- 0x6bff4001 /* 0001affd - 0001affe [ 2] */, //
- 0x6c000122 /* 0001b000 - 0001b122 [ 291] */, //
- 0x6c4c8000 /* 0001b132 - 0001b132 [ 1] */, //
- 0x6c540002 /* 0001b150 - 0001b152 [ 3] */, //
- 0x6c554000 /* 0001b155 - 0001b155 [ 1] */, //
- 0x6c590003 /* 0001b164 - 0001b167 [ 4] */, //
- 0x6c5c018b /* 0001b170 - 0001b2fb [ 396] */, //
- 0x7c010000 /* 0001f004 - 0001f004 [ 1] */, //
- 0x7c33c000 /* 0001f0cf - 0001f0cf [ 1] */, //
- 0x7c638000 /* 0001f18e - 0001f18e [ 1] */, //
- 0x7c644009 /* 0001f191 - 0001f19a [ 10] */, //
- 0x7c800002 /* 0001f200 - 0001f202 [ 3] */, //
- 0x7c84002b /* 0001f210 - 0001f23b [ 44] */, //
- 0x7c900008 /* 0001f240 - 0001f248 [ 9] */, //
- 0x7c940001 /* 0001f250 - 0001f251 [ 2] */, //
- 0x7c980005 /* 0001f260 - 0001f265 [ 6] */, //
- 0x7cc0034f /* 0001f300 - 0001f64f [ 848] */, //
- 0x7da00045 /* 0001f680 - 0001f6c5 [ 70] */, //
- 0x7db30000 /* 0001f6cc - 0001f6cc [ 1] */, //
- 0x7db40002 /* 0001f6d0 - 0001f6d2 [ 3] */, //
- 0x7db54002 /* 0001f6d5 - 0001f6d7 [ 3] */, //
- 0x7db70003 /* 0001f6dc - 0001f6df [ 4] */, //
- 0x7dbac001 /* 0001f6eb - 0001f6ec [ 2] */, //
- 0x7dbd0008 /* 0001f6f4 - 0001f6fc [ 9] */, //
- 0x7df8000b /* 0001f7e0 - 0001f7eb [ 12] */, //
- 0x7dfc0000 /* 0001f7f0 - 0001f7f0 [ 1] */, //
- 0x7e4000ff /* 0001f900 - 0001f9ff [ 256] */, //
- 0x7e9c000c /* 0001fa70 - 0001fa7c [ 13] */, //
- 0x7ea00008 /* 0001fa80 - 0001fa88 [ 9] */, //
- 0x7ea4002d /* 0001fa90 - 0001fabd [ 46] */, //
- 0x7eafc006 /* 0001fabf - 0001fac5 [ 7] */, //
- 0x7eb3800d /* 0001face - 0001fadb [ 14] */, //
- 0x7eb80008 /* 0001fae0 - 0001fae8 [ 9] */, //
- 0x7ebc0008 /* 0001faf0 - 0001faf8 [ 9] */, //
- 0x80003fff /* 00020000 - 00023fff [16384] */, //
- 0x90003fff /* 00024000 - 00027fff [16384] */, //
- 0xa0003fff /* 00028000 - 0002bfff [16384] */, //
- 0xb0003ffd /* 0002c000 - 0002fffd [16382] */, //
- 0xc0003fff /* 00030000 - 00033fff [16384] */, //
- 0xd0003fff /* 00034000 - 00037fff [16384] */, //
- 0xe0003fff /* 00038000 - 0003bfff [16384] */, //
- 0xf0003ffd /* 0003c000 - 0003fffd [16382] */};
-
-/// The upper bound entry of EastAsianWidth.txt.
-///
-/// Values greater than this value may have more than 18 significant bits.
-/// They always have a width of 1. This property makes it possible to store
-/// the table in its compact form.
-inline constexpr uint32_t __table_upper_bound = 0x0003fffd;
-
-/// Returns the estimated width of a Unicode code point.
-///
-/// \\pre The code point is a valid Unicode code point.
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int __estimated_width(const char32_t __code_point) noexcept {
- // Since __table_upper_bound contains the unshifted range do the
- // comparison without shifting.
- if (__code_point > __table_upper_bound) [[unlikely]]
- return 1;
-
- // When the code-point is less than the first element in the table
- // the lookup is quite expensive. Since quite some scripts are in
- // that range, it makes sense to validate that first.
- // The std_format_spec_string_unicode benchmark gives a measurable
- // improvement.
- if (__code_point < (__entries[0] >> 14))
- return 1;
-
- ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
- if (__i == 0)
- return 1;
-
- --__i;
- uint32_t __upper_bound = (__entries[__i] >> 14) + (__entries[__i] & 0x3fffu);
- return 1 + (__code_point <= __upper_bound);
-}
-
-} // namespace __width_estimation_table
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FORMAT_WIDTH_ESTIMATION_TABLE_H
diff --git a/libcxx/include/__cxx03/__format/write_escaped.h b/libcxx/include/__cxx03/__format/write_escaped.h
deleted file mode 100644
index 5711e7c539d02..0000000000000
--- a/libcxx/include/__cxx03/__format/write_escaped.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FORMAT_WRITE_ESCAPED_H
-#define _LIBCPP___CXX03___FORMAT_WRITE_ESCAPED_H
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__algorithm/ranges_for_each.h>
-#include <__cxx03/__charconv/to_chars_integral.h>
-#include <__cxx03/__charconv/to_chars_result.h>
-#include <__cxx03/__chrono/statically_widen.h>
-#include <__cxx03/__format/escaped_output_table.h>
-#include <__cxx03/__format/formatter_output.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__format/unicode.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__system_error/errc.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/string_view>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace __formatter {
-
-#if _LIBCPP_STD_VER >= 20
-
-/// Writes a string using format's width estimation algorithm.
-///
-/// \note When \c _LIBCPP_HAS_NO_UNICODE is defined the function assumes the
-/// input is ASCII.
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__write_string(basic_string_view<_CharT> __str,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
- if (!__specs.__has_precision())
- return __formatter::__write_string_no_precision(__str, std::move(__out_it), __specs);
-
- int __size = __formatter::__truncate(__str, __specs.__precision_);
-
- return __formatter::__write(__str.begin(), __str.end(), std::move(__out_it), __specs, __size);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-#if _LIBCPP_STD_VER >= 23
-
-struct __nul_terminator {};
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI bool operator==(const _CharT* __cstr, __nul_terminator) {
- return *__cstr == _CharT('\0');
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void
-__write_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value, const _CharT* __prefix) {
- back_insert_iterator __out_it{__str};
- std::ranges::copy(__prefix, __nul_terminator{}, __out_it);
-
- char __buffer[8];
- to_chars_result __r = std::to_chars(std::begin(__buffer), std::end(__buffer), __value, 16);
- _LIBCPP_ASSERT_INTERNAL(__r.ec == errc(0), "Internal buffer too small");
- std::ranges::copy(std::begin(__buffer), __r.ptr, __out_it);
-
- __str += _CharT('}');
-}
-
-// [format.string.escaped]/2.2.1.2
-// ...
-// then the sequence \u{hex-digit-sequence} is appended to E, where
-// hex-digit-sequence is the shortest hexadecimal representation of C using
-// lower-case hexadecimal digits.
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void __write_well_formed_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value) {
- __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\u{"));
-}
-
-// [format.string.escaped]/2.2.3
-// Otherwise (X is a sequence of ill-formed code units), each code unit U is
-// appended to E in order as the sequence \x{hex-digit-sequence}, where
-// hex-digit-sequence is the shortest hexadecimal representation of U using
-// lower-case hexadecimal digits.
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void __write_escape_ill_formed_code_unit(basic_string<_CharT>& __str, char32_t __value) {
- __formatter::__write_escaped_code_unit(__str, __value, _LIBCPP_STATICALLY_WIDEN(_CharT, "\\x{"));
-}
-
-template <class _CharT>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
-__is_escaped_sequence_written(basic_string<_CharT>& __str, bool __last_escaped, char32_t __value) {
-# ifdef _LIBCPP_HAS_NO_UNICODE
- // For ASCII assume everything above 127 is printable.
- if (__value > 127)
- return false;
-# endif
-
- // [format.string.escaped]/2.2.1.2.1
- // CE is UTF-8, UTF-16, or UTF-32 and C corresponds to a Unicode scalar
- // value whose Unicode property General_Category has a value in the groups
- // Separator (Z) or Other (C), as described by UAX #44 of the Unicode Standard,
- if (!__escaped_output_table::__needs_escape(__value))
- // [format.string.escaped]/2.2.1.2.2
- // CE is UTF-8, UTF-16, or UTF-32 and C corresponds to a Unicode scalar
- // value with the Unicode property Grapheme_Extend=Yes as described by UAX
- // #44 of the Unicode Standard and C is not immediately preceded in S by a
- // character P appended to E without translation to an escape sequence,
- if (!__last_escaped || __extended_grapheme_custer_property_boundary::__get_property(__value) !=
- __extended_grapheme_custer_property_boundary::__property::__Extend)
- return false;
-
- __formatter::__write_well_formed_escaped_code_unit(__str, __value);
- return true;
-}
-
-template <class _CharT>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr char32_t __to_char32(_CharT __value) {
- return static_cast<make_unsigned_t<_CharT>>(__value);
-}
-
-enum class __escape_quotation_mark { __apostrophe, __double_quote };
-
-// [format.string.escaped]/2
-template <class _CharT>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool __is_escaped_sequence_written(
- basic_string<_CharT>& __str, char32_t __value, bool __last_escaped, __escape_quotation_mark __mark) {
- // 2.2.1.1 - Mapped character in [tab:format.escape.sequences]
- switch (__value) {
- case _CharT('\t'):
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\t");
- return true;
- case _CharT('\n'):
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\n");
- return true;
- case _CharT('\r'):
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, "\\r");
- return true;
- case _CharT('\''):
- if (__mark == __escape_quotation_mark::__apostrophe)
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\')");
- else
- __str += __value;
- return true;
- case _CharT('"'):
- if (__mark == __escape_quotation_mark::__double_quote)
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\")");
- else
- __str += __value;
- return true;
- case _CharT('\\'):
- __str += _LIBCPP_STATICALLY_WIDEN(_CharT, R"(\\)");
- return true;
-
- // 2.2.1.2 - Space
- case _CharT(' '):
- __str += __value;
- return true;
- }
-
- // 2.2.2
- // Otherwise, if X is a shift sequence, the effect on E and further
- // decoding of S is unspecified.
- // For now shift sequences are ignored and treated as Unicode. Other parts
- // of the format library do the same. It's unknown how ostream treats them.
- // TODO FMT determine what to do with shift sequences.
-
- // 2.2.1.2.1 and 2.2.1.2.2 - Escape
- return __formatter::__is_escaped_sequence_written(__str, __last_escaped, __formatter::__to_char32(__value));
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI void
-__escape(basic_string<_CharT>& __str, basic_string_view<_CharT> __values, __escape_quotation_mark __mark) {
- __unicode::__code_point_view<_CharT> __view{__values.begin(), __values.end()};
-
- // When the first code unit has the property Grapheme_Extend=Yes it needs to
- // be escaped. This happens when the previous code unit was also escaped.
- bool __escape = true;
- while (!__view.__at_end()) {
- auto __first = __view.__position();
- typename __unicode::__consume_result __result = __view.__consume();
- if (__result.__status == __unicode::__consume_result::__ok) {
- __escape = __formatter::__is_escaped_sequence_written(__str, __result.__code_point, __escape, __mark);
- if (!__escape)
- // 2.2.1.3 - Add the character
- ranges::copy(__first, __view.__position(), std::back_insert_iterator(__str));
- } else {
- // 2.2.3 sequence of ill-formed code units
- ranges::for_each(__first, __view.__position(), [&](_CharT __value) {
- __formatter::__write_escape_ill_formed_code_unit(__str, __formatter::__to_char32(__value));
- });
- }
- }
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__format_escaped_char(_CharT __value,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
- basic_string<_CharT> __str;
- __str += _CharT('\'');
- __formatter::__escape(__str, basic_string_view{std::addressof(__value), 1}, __escape_quotation_mark::__apostrophe);
- __str += _CharT('\'');
- return __formatter::__write(__str.data(), __str.data() + __str.size(), std::move(__out_it), __specs, __str.size());
-}
-
-template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__format_escaped_string(basic_string_view<_CharT> __values,
- output_iterator<const _CharT&> auto __out_it,
- __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
- basic_string<_CharT> __str;
- __str += _CharT('"');
- __formatter::__escape(__str, __values, __escape_quotation_mark::__double_quote);
- __str += _CharT('"');
- return __formatter::__write_string(basic_string_view{__str}, std::move(__out_it), __specs);
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-} // namespace __formatter
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FORMAT_WRITE_ESCAPED_H
diff --git a/libcxx/include/__cxx03/__functional/bind.h b/libcxx/include/__cxx03/__functional/bind.h
index 70c4be05ce65e..ce2f27ad7dbd8 100644
--- a/libcxx/include/__cxx03/__functional/bind.h
+++ b/libcxx/include/__cxx03/__functional/bind.h
@@ -11,14 +11,14 @@
#define _LIBCPP___CXX03___FUNCTIONAL_BIND_H
#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__functional/weak_result_type.h>
#include <__cxx03/__fwd/functional.h>
#include <__cxx03/__type_traits/decay.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_reference_wrapper.h>
#include <__cxx03/__type_traits/is_void.h>
+#include <__cxx03/__type_traits/remove_cvref.h>
#include <__cxx03/cstddef>
-#include <__cxx03/tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__functional/bind_back.h b/libcxx/include/__cxx03/__functional/bind_back.h
deleted file mode 100644
index 2e333b1b14d6a..0000000000000
--- a/libcxx/include/__cxx03/__functional/bind_back.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_BIND_BACK_H
-#define _LIBCPP___CXX03___FUNCTIONAL_BIND_BACK_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/perfect_forward.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <size_t _NBound, class = make_index_sequence<_NBound>>
-struct __bind_back_op;
-
-template <size_t _NBound, size_t... _Ip>
-struct __bind_back_op<_NBound, index_sequence<_Ip...>> {
- template <class _Fn, class _BoundArgs, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f, _BoundArgs&& __bound_args, _Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Fn>(__f),
- std::forward<_Args>(__args)...,
- std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)))
- -> decltype(std::invoke(std::forward<_Fn>(__f),
- std::forward<_Args>(__args)...,
- std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...)) {
- return std::invoke(std::forward<_Fn>(__f),
- std::forward<_Args>(__args)...,
- std::get<_Ip>(std::forward<_BoundArgs>(__bound_args))...);
- }
-};
-
-template <class _Fn, class _BoundArgs>
-struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs> {
- using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
-};
-
-template <class _Fn, class... _Args>
- requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
- (is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) noexcept(
- noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
- std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
- -> decltype(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
- std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))) {
- return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
- std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
-}
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Fn, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr auto bind_back(_Fn&& __f, _Args&&... __args) {
- static_assert(is_constructible_v<decay_t<_Fn>, _Fn>, "bind_back requires decay_t<F> to be constructible from F");
- static_assert(is_move_constructible_v<decay_t<_Fn>>, "bind_back requires decay_t<F> to be move constructible");
- static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...),
- "bind_back requires all decay_t<Args> to be constructible from respective Args");
- static_assert((is_move_constructible_v<decay_t<_Args>> && ...),
- "bind_back requires all decay_t<Args> to be move constructible");
- return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
- std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...));
-}
-# endif // _LIBCPP_STD_VER >= 23
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_BACK_H
diff --git a/libcxx/include/__cxx03/__functional/bind_front.h b/libcxx/include/__cxx03/__functional/bind_front.h
deleted file mode 100644
index 6447c2d1bc2eb..0000000000000
--- a/libcxx/include/__cxx03/__functional/bind_front.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_BIND_FRONT_H
-#define _LIBCPP___CXX03___FUNCTIONAL_BIND_FRONT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/perfect_forward.h>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-struct __bind_front_op {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const noexcept(
- noexcept(std::invoke(std::forward<_Args>(__args)...))) -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
- return std::invoke(std::forward<_Args>(__args)...);
- }
-};
-
-template <class _Fn, class... _BoundArgs>
-struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
- using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
-};
-
-template <class _Fn, class... _Args>
- requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
- (is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
-_LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Fn&& __f, _Args&&... __args) {
- return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_FRONT_H
diff --git a/libcxx/include/__cxx03/__functional/boyer_moore_searcher.h b/libcxx/include/__cxx03/__functional/boyer_moore_searcher.h
deleted file mode 100644
index 384c4b53cc270..0000000000000
--- a/libcxx/include/__cxx03/__functional/boyer_moore_searcher.h
+++ /dev/null
@@ -1,306 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
-#define _LIBCPP___CXX03___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/__algorithm/fill_n.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/array>
-#include <__cxx03/unordered_map>
-#include <__cxx03/vector>
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/>
-class _BMSkipTable;
-
-// General case for BM data searching; use a map
-template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
-class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
-private:
- using value_type = _Value;
- using key_type = _Key;
-
- const value_type __default_value_;
- unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(
- size_t __sz, value_type __default_value, _Hash __hash, _BinaryPredicate __pred)
- : __default_value_(__default_value), __table_(__sz, __hash, __pred) {}
-
- _LIBCPP_HIDE_FROM_ABI void insert(const key_type& __key, value_type __val) { __table_[__key] = __val; }
-
- _LIBCPP_HIDE_FROM_ABI value_type operator[](const key_type& __key) const {
- auto __it = __table_.find(__key);
- return __it == __table_.end() ? __default_value_ : __it->second;
- }
-};
-
-// Special case small numeric values; use an array
-template <class _Key, class _Value, class _Hash, class _BinaryPredicate>
-class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
-private:
- using value_type = _Value;
- using key_type = _Key;
-
- using unsigned_key_type = make_unsigned_t<key_type>;
- std::array<value_type, 256> __table_;
- static_assert(numeric_limits<unsigned_key_type>::max() < 256);
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit _BMSkipTable(size_t, value_type __default_value, _Hash, _BinaryPredicate) {
- std::fill_n(__table_.data(), __table_.size(), __default_value);
- }
-
- _LIBCPP_HIDE_FROM_ABI void insert(key_type __key, value_type __val) {
- __table_[static_cast<unsigned_key_type>(__key)] = __val;
- }
-
- _LIBCPP_HIDE_FROM_ABI value_type operator[](key_type __key) const {
- return __table_[static_cast<unsigned_key_type>(__key)];
- }
-};
-
-template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
- class _BinaryPredicate = equal_to<>>
-class _LIBCPP_TEMPLATE_VIS boyer_moore_searcher {
-private:
- using difference_type = typename std::iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename std::iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type =
- _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
- is_same_v<_BinaryPredicate, equal_to<>>>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI boyer_moore_searcher(
- _RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, -1, __hash, __pred_)),
- __suffix_(std::__allocate_shared_unbounded_array<difference_type[]>(
- allocator<difference_type>(), __pattern_length_ + 1)) {
- difference_type __i = 0;
- while (__first != __last) {
- __skip_table_->insert(*__first, __i);
- ++__first;
- ++__i;
- }
- __build_suffix_table(__first_, __last_, __pred_);
- }
-
- template <class _RandomAccessIterator2>
- _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
- operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
- static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type,
- typename iterator_traits<_RandomAccessIterator2>::value_type>::value,
- "Corpus and Pattern iterators must point to the same type");
- if (__first == __last)
- return std::make_pair(__last, __last);
- if (__first_ == __last_)
- return std::make_pair(__first, __first);
-
- if (__pattern_length_ > (__last - __first))
- return std::make_pair(__last, __last);
- return __search(__first, __last);
- }
-
-private:
- _RandomAccessIterator1 __first_;
- _RandomAccessIterator1 __last_;
- _BinaryPredicate __pred_;
- difference_type __pattern_length_;
- shared_ptr<__skip_table_type> __skip_table_;
- shared_ptr<difference_type[]> __suffix_;
-
- template <class _RandomAccessIterator2>
- _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
- __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
- const __skip_table_type& __skip_table = *__skip_table_;
-
- while (__current <= __last) {
- difference_type __j = __pattern_length_;
- while (__pred_(__first_[__j - 1], __current[__j - 1])) {
- --__j;
- if (__j == 0)
- return std::make_pair(__current, __current + __pattern_length_);
- }
-
- difference_type __k = __skip_table[__current[__j - 1]];
- difference_type __m = __j - __k - 1;
- if (__k < __j && __m > __suffix_[__j])
- __current += __m;
- else
- __current += __suffix_[__j];
- }
- return std::make_pair(__l, __l);
- }
-
- template <class _Iterator, class _Container>
- _LIBCPP_HIDE_FROM_ABI void
- __compute_bm_prefix(_Iterator __first, _Iterator __last, _BinaryPredicate __pred, _Container& __prefix) {
- const size_t __count = __last - __first;
-
- __prefix[0] = 0;
- size_t __k = 0;
-
- for (size_t __i = 1; __i != __count; ++__i) {
- while (__k > 0 && !__pred(__first[__k], __first[__i]))
- __k = __prefix[__k - 1];
-
- if (__pred(__first[__k], __first[__i]))
- ++__k;
- __prefix[__i] = __k;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI void
- __build_suffix_table(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _BinaryPredicate __pred) {
- const size_t __count = __last - __first;
-
- if (__count == 0)
- return;
-
- vector<difference_type> __scratch(__count);
-
- __compute_bm_prefix(__first, __last, __pred, __scratch);
- for (size_t __i = 0; __i <= __count; ++__i)
- __suffix_[__i] = __count - __scratch[__count - 1];
-
- using _ReverseIter = reverse_iterator<_RandomAccessIterator1>;
- __compute_bm_prefix(_ReverseIter(__last), _ReverseIter(__first), __pred, __scratch);
-
- for (size_t __i = 0; __i != __count; ++__i) {
- const size_t __j = __count - __scratch[__i];
- const difference_type __k = __i - __scratch[__i] + 1;
-
- if (__suffix_[__j] > __k)
- __suffix_[__j] = __k;
- }
- }
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_searcher);
-
-template <class _RandomAccessIterator1,
- class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
- class _BinaryPredicate = equal_to<>>
-class _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher {
-private:
- using difference_type = typename iterator_traits<_RandomAccessIterator1>::difference_type;
- using value_type = typename iterator_traits<_RandomAccessIterator1>::value_type;
- using __skip_table_type =
- _BMSkipTable<value_type,
- difference_type,
- _Hash,
- _BinaryPredicate,
- is_integral_v<value_type> && sizeof(value_type) == 1 && is_same_v<_Hash, hash<value_type>> &&
- is_same_v<_BinaryPredicate, equal_to<>>>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI boyer_moore_horspool_searcher(
- _RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _Hash __hash = _Hash(),
- _BinaryPredicate __pred = _BinaryPredicate())
- : __first_(__first),
- __last_(__last),
- __pred_(__pred),
- __pattern_length_(__last - __first),
- __skip_table_(std::make_shared<__skip_table_type>(__pattern_length_, __pattern_length_, __hash, __pred_)) {
- if (__first == __last)
- return;
- --__last;
- difference_type __i = 0;
- while (__first != __last) {
- __skip_table_->insert(*__first, __pattern_length_ - 1 - __i);
- ++__first;
- ++__i;
- }
- }
-
- template <class _RandomAccessIterator2>
- _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
- operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
- static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type,
- typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value,
- "Corpus and Pattern iterators must point to the same type");
- if (__first == __last)
- return std::make_pair(__last, __last);
- if (__first_ == __last_)
- return std::make_pair(__first, __first);
-
- if (__pattern_length_ > __last - __first)
- return std::make_pair(__last, __last);
-
- return __search(__first, __last);
- }
-
-private:
- _RandomAccessIterator1 __first_;
- _RandomAccessIterator1 __last_;
- _BinaryPredicate __pred_;
- difference_type __pattern_length_;
- shared_ptr<__skip_table_type> __skip_table_;
-
- template <class _RandomAccessIterator2>
- _LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
- __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const {
- _RandomAccessIterator2 __current = __f;
- const _RandomAccessIterator2 __last = __l - __pattern_length_;
- const __skip_table_type& __skip_table = *__skip_table_;
-
- while (__current <= __last) {
- difference_type __j = __pattern_length_;
- while (__pred_(__first_[__j - 1], __current[__j - 1])) {
- --__j;
- if (__j == 0)
- return std::make_pair(__current, __current + __pattern_length_);
- }
- __current += __skip_table[__current[__pattern_length_ - 1]];
- }
- return std::make_pair(__l, __l);
- }
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(boyer_moore_horspool_searcher);
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
diff --git a/libcxx/include/__cxx03/__functional/compose.h b/libcxx/include/__cxx03/__functional/compose.h
deleted file mode 100644
index afb6358ad535e..0000000000000
--- a/libcxx/include/__cxx03/__functional/compose.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_COMPOSE_H
-#define _LIBCPP___CXX03___FUNCTIONAL_COMPOSE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/perfect_forward.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-struct __compose_op {
- template <class _Fn1, class _Fn2, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept(
- std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))))
- -> decltype(std::invoke(std::forward<_Fn1>(__f1),
- std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...))) {
- return std::invoke(std::forward<_Fn1>(__f1), std::invoke(std::forward<_Fn2>(__f2), std::forward<_Args>(__args)...));
- }
-};
-
-template <class _Fn1, class _Fn2>
-struct __compose_t : __perfect_forward<__compose_op, _Fn1, _Fn2> {
- using __perfect_forward<__compose_op, _Fn1, _Fn2>::__perfect_forward;
-};
-
-template <class _Fn1, class _Fn2>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcept(
- noexcept(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))))
- -> decltype(__compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2))) {
- return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2));
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_COMPOSE_H
diff --git a/libcxx/include/__cxx03/__functional/default_searcher.h b/libcxx/include/__cxx03/__functional/default_searcher.h
deleted file mode 100644
index f1ad66990c257..0000000000000
--- a/libcxx/include/__cxx03/__functional/default_searcher.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_DEFAULT_SEARCHER_H
-#define _LIBCPP___CXX03___FUNCTIONAL_DEFAULT_SEARCHER_H
-
-#include <__cxx03/__algorithm/search.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__utility/pair.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-// default searcher
-template <class _ForwardIterator, class _BinaryPredicate = equal_to<>>
-class _LIBCPP_TEMPLATE_VIS default_searcher {
-public:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- default_searcher(_ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate())
- : __first_(__f), __last_(__l), __pred_(__p) {}
-
- template <typename _ForwardIterator2>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator2, _ForwardIterator2>
- operator()(_ForwardIterator2 __f, _ForwardIterator2 __l) const {
- auto __proj = __identity();
- return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj);
- }
-
-private:
- _ForwardIterator __first_;
- _ForwardIterator __last_;
- _BinaryPredicate __pred_;
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher);
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_DEFAULT_SEARCHER_H
diff --git a/libcxx/include/__cxx03/__functional/function.h b/libcxx/include/__cxx03/__functional/function.h
deleted file mode 100644
index 891652f1da25f..0000000000000
--- a/libcxx/include/__cxx03/__functional/function.h
+++ /dev/null
@@ -1,1048 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_FUNCTION_H
-#define _LIBCPP___CXX03___FUNCTIONAL_FUNCTION_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__exception/exception.h>
-#include <__cxx03/__functional/binary_function.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/unary_function.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory/allocator_destructor.h>
-#include <__cxx03/__memory/allocator_traits.h>
-#include <__cxx03/__memory/builtin_new_allocator.h>
-#include <__cxx03/__memory/compressed_pair.h>
-#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__type_traits/aligned_storage.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_core_convertible.h>
-#include <__cxx03/__type_traits/is_scalar.h>
-#include <__cxx03/__type_traits/is_trivially_constructible.h>
-#include <__cxx03/__type_traits/is_trivially_destructible.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/strip_signature.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/piecewise_construct.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/new>
-#include <__cxx03/tuple>
-#include <__cxx03/typeinfo>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#ifndef _LIBCPP_CXX03_LANG
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// bad_function_call
-
-_LIBCPP_DIAGNOSTIC_PUSH
-# if !_LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION
-_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
-# endif
-class _LIBCPP_EXPORTED_FROM_ABI bad_function_call : public exception {
-public:
- _LIBCPP_HIDE_FROM_ABI bad_function_call() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call(const bad_function_call&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_function_call& operator=(const bad_function_call&) _NOEXCEPT = default;
-// Note that when a key function is not used, every translation unit that uses
-// bad_function_call will end up containing a weak definition of the vtable and
-// typeinfo.
-# if _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION
- ~bad_function_call() _NOEXCEPT override;
-# else
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~bad_function_call() _NOEXCEPT override {}
-# endif
-
-# ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
- const char* what() const _NOEXCEPT override;
-# endif
-};
-_LIBCPP_DIAGNOSTIC_POP
-
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_function_call();
-# else
- _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
-# endif
-}
-
-template <class _Fp>
-class _LIBCPP_TEMPLATE_VIS function; // undefined
-
-namespace __function {
-
-template <class _Rp>
-struct __maybe_derive_from_unary_function {};
-
-template <class _Rp, class _A1>
-struct __maybe_derive_from_unary_function<_Rp(_A1)> : public __unary_function<_A1, _Rp> {};
-
-template <class _Rp>
-struct __maybe_derive_from_binary_function {};
-
-template <class _Rp, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> : public __binary_function<_A1, _A2, _Rp> {};
-
-template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp const&) {
- return true;
-}
-
-template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI bool __not_null(_Fp* __ptr) {
- return __ptr;
-}
-
-template <class _Ret, class _Class>
-_LIBCPP_HIDE_FROM_ABI bool __not_null(_Ret _Class::*__ptr) {
- return __ptr;
-}
-
-template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI bool __not_null(function<_Fp> const& __f) {
- return !!__f;
-}
-
-# ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
-template <class _Rp, class... _Args>
-_LIBCPP_HIDE_FROM_ABI bool __not_null(_Rp (^__p)(_Args...)) {
- return __p;
-}
-# endif
-
-} // namespace __function
-
-namespace __function {
-
-// __alloc_func holds a functor and an allocator.
-
-template <class _Fp, class _Ap, class _FB>
-class __alloc_func;
-template <class _Fp, class _FB>
-class __default_alloc_func;
-
-template <class _Fp, class _Ap, class _Rp, class... _ArgTypes>
-class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> {
- __compressed_pair<_Fp, _Ap> __f_;
-
-public:
- typedef _LIBCPP_NODEBUG _Fp _Target;
- typedef _LIBCPP_NODEBUG _Ap _Alloc;
-
- _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_.first(); }
-
- // WIN32 APIs may define __allocator, so use __get_allocator instead.
- _LIBCPP_HIDE_FROM_ABI const _Alloc& __get_allocator() const { return __f_.second(); }
-
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple()) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, const _Alloc& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(const _Target& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(__f), std::forward_as_tuple(std::move(__a))) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __alloc_func(_Target&& __f, _Alloc&& __a)
- : __f_(piecewise_construct, std::forward_as_tuple(std::move(__f)), std::forward_as_tuple(std::move(__a))) {}
-
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_.first(), std::forward<_ArgTypes>(__arg)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI __alloc_func* __clone() const {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _AA;
- _AA __a(__f_.second());
- typedef __allocator_destructor<_AA> _Dp;
- unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a));
- return __hold.release();
- }
-
- _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~__compressed_pair<_Target, _Alloc>(); }
-
- _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__alloc_func* __f) {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __alloc_func> _FunAlloc;
- _FunAlloc __a(__f->__get_allocator());
- __f->destroy();
- __a.deallocate(__f, 1);
- }
-};
-
-template <class _Fp, class _Rp, class... _ArgTypes>
-class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
- _Fp __f_;
-
-public:
- typedef _LIBCPP_NODEBUG _Fp _Target;
-
- _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_; }
-
- _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
-
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __arg) {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(__f_, std::forward<_ArgTypes>(__arg)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI __default_alloc_func* __clone() const {
- __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
- __default_alloc_func* __res = ::new ((void*)__hold.get()) __default_alloc_func(__f_);
- (void)__hold.release();
- return __res;
- }
-
- _LIBCPP_HIDE_FROM_ABI void destroy() _NOEXCEPT { __f_.~_Target(); }
-
- _LIBCPP_HIDE_FROM_ABI static void __destroy_and_delete(__default_alloc_func* __f) {
- __f->destroy();
- __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1);
- }
-};
-
-// __base provides an abstract interface for copyable functors.
-
-template <class _Fp>
-class _LIBCPP_TEMPLATE_VIS __base;
-
-template <class _Rp, class... _ArgTypes>
-class __base<_Rp(_ArgTypes...)> {
-public:
- __base(const __base&) = delete;
- __base& operator=(const __base&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI __base() {}
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
- virtual __base* __clone() const = 0;
- virtual void __clone(__base*) const = 0;
- virtual void destroy() _NOEXCEPT = 0;
- virtual void destroy_deallocate() _NOEXCEPT = 0;
- virtual _Rp operator()(_ArgTypes&&...) = 0;
-# ifndef _LIBCPP_HAS_NO_RTTI
- virtual const void* target(const type_info&) const _NOEXCEPT = 0;
- virtual const std::type_info& target_type() const _NOEXCEPT = 0;
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-// __func implements __base for a given functor type.
-
-template <class _FD, class _Alloc, class _FB>
-class __func;
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-class __func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
- __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f) : __f_(std::move(__f)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __func(const _Fp& __f, _Alloc&& __a) : __f_(__f, std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(std::move(__f), std::move(__a)) {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
-# ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-__base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- typedef __allocator_destructor<_Ap> _Dp;
- unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a));
- return __hold.release();
-}
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const {
- ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
-}
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT {
- __f_.destroy();
-}
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, __func> _Ap;
- _Ap __a(__f_.__get_allocator());
- __f_.destroy();
- __a.deallocate(this, 1);
-}
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-_Rp __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
- return __f_(std::forward<_ArgTypes>(__arg)...);
-}
-
-# ifndef _LIBCPP_HAS_NO_RTTI
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-const void* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT {
- if (__ti == typeid(_Fp))
- return std::addressof(__f_.__target());
- return nullptr;
-}
-
-template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
-const std::type_info& __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
- return typeid(_Fp);
-}
-
-# endif // _LIBCPP_HAS_NO_RTTI
-
-// __value_func creates a value-type from a __func.
-
-template <class _Fp>
-class __value_func;
-
-template <class _Rp, class... _ArgTypes>
-class __value_func<_Rp(_ArgTypes...)> {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<3 * sizeof(void*)>::type __buf_;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
-
- typedef __base<_Rp(_ArgTypes...)> __func;
- __func* __f_;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI static __func* __as_base(void* __p) { return reinterpret_cast<__func*>(__p); }
-
-public:
- _LIBCPP_HIDE_FROM_ABI __value_func() _NOEXCEPT : __f_(nullptr) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __value_func(_Fp&& __f, const _Alloc& __a) : __f_(nullptr) {
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f)) {
- _FunAlloc __af(__a);
- if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value &&
- is_nothrow_copy_constructible<_FunAlloc>::value) {
- __f_ = ::new ((void*)&__buf_) _Fun(std::move(__f), _Alloc(__af));
- } else {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__a));
- __f_ = __hold.release();
- }
- }
- }
-
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __value_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __value_func(_Fp&& __f) : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
-
- _LIBCPP_HIDE_FROM_ABI __value_func(const __value_func& __f) {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_) {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- } else
- __f_ = __f.__f_->__clone();
- }
-
- _LIBCPP_HIDE_FROM_ABI __value_func(__value_func&& __f) _NOEXCEPT {
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_) {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- } else {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__value_func() {
- if ((void*)__f_ == &__buf_)
- __f_->destroy();
- else if (__f_)
- __f_->destroy_deallocate();
- }
-
- _LIBCPP_HIDE_FROM_ABI __value_func& operator=(__value_func&& __f) {
- *this = nullptr;
- if (__f.__f_ == nullptr)
- __f_ = nullptr;
- else if ((void*)__f.__f_ == &__f.__buf_) {
- __f_ = __as_base(&__buf_);
- __f.__f_->__clone(__f_);
- } else {
- __f_ = __f.__f_;
- __f.__f_ = nullptr;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI __value_func& operator=(nullptr_t) {
- __func* __f = __f_;
- __f_ = nullptr;
- if ((void*)__f == &__buf_)
- __f->destroy();
- else if (__f)
- __f->destroy_deallocate();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
- if (__f_ == nullptr)
- __throw_bad_function_call();
- return (*__f_)(std::forward<_ArgTypes>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(__value_func& __f) _NOEXCEPT {
- if (&__f == this)
- return;
- if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_) {
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
- typename aligned_storage<sizeof(__buf_)>::type __tempbuf;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
- __func* __t = __as_base(&__tempbuf);
- __f_->__clone(__t);
- __f_->destroy();
- __f_ = nullptr;
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = nullptr;
- __f_ = __as_base(&__buf_);
- __t->__clone(__as_base(&__f.__buf_));
- __t->destroy();
- __f.__f_ = __as_base(&__f.__buf_);
- } else if ((void*)__f_ == &__buf_) {
- __f_->__clone(__as_base(&__f.__buf_));
- __f_->destroy();
- __f_ = __f.__f_;
- __f.__f_ = __as_base(&__f.__buf_);
- } else if ((void*)__f.__f_ == &__f.__buf_) {
- __f.__f_->__clone(__as_base(&__buf_));
- __f.__f_->destroy();
- __f.__f_ = __f_;
- __f_ = __as_base(&__buf_);
- } else
- std::swap(__f_, __f.__f_);
- }
-
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
-
-# ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT {
- if (__f_ == nullptr)
- return typeid(void);
- return __f_->target_type();
- }
-
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
- if (__f_ == nullptr)
- return nullptr;
- return (const _Tp*)__f_->target(typeid(_Tp));
- }
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-// Storage for a functor object, to be used with __policy to manage copy and
-// destruction.
-union __policy_storage {
- mutable char __small[sizeof(void*) * 2];
- void* __large;
-};
-
-// True if _Fun can safely be held in __policy_storage.__small.
-template <typename _Fun>
-struct __use_small_storage
- : public integral_constant<
- bool,
- sizeof(_Fun) <= sizeof(__policy_storage)&& _LIBCPP_ALIGNOF(_Fun) <= _LIBCPP_ALIGNOF(__policy_storage) &&
- is_trivially_copy_constructible<_Fun>::value && is_trivially_destructible<_Fun>::value> {};
-
-// Policy contains information about how to copy, destroy, and move the
-// underlying functor. You can think of it as a vtable of sorts.
-struct __policy {
- // Used to copy or destroy __large values. null for trivial objects.
- void* (*const __clone)(const void*);
- void (*const __destroy)(void*);
-
- // True if this is the null policy (no value).
- const bool __is_null;
-
- // The target type. May be null if RTTI is disabled.
- const std::type_info* const __type_info;
-
- // Returns a pointer to a static policy object suitable for the functor
- // type.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy* __create() {
- return __choose_policy<_Fun>(__use_small_storage<_Fun>());
- }
-
- _LIBCPP_HIDE_FROM_ABI static const __policy* __create_empty() {
- static constexpr __policy __policy = {
- nullptr,
- nullptr,
- true,
-# ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(void)
-# else
- nullptr
-# endif
- };
- return &__policy;
- }
-
-private:
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void* __large_clone(const void* __s) {
- const _Fun* __f = static_cast<const _Fun*>(__s);
- return __f->__clone();
- }
-
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static void __large_destroy(void* __s) {
- _Fun::__destroy_and_delete(static_cast<_Fun*>(__s));
- }
-
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ false_type) {
- static constexpr __policy __policy = {
- &__large_clone<_Fun>,
- &__large_destroy<_Fun>,
- false,
-# ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-# else
- nullptr
-# endif
- };
- return &__policy;
- }
-
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ true_type) {
- static constexpr __policy __policy = {
- nullptr,
- nullptr,
- false,
-# ifndef _LIBCPP_HAS_NO_RTTI
- &typeid(typename _Fun::_Target)
-# else
- nullptr
-# endif
- };
- return &__policy;
- }
-};
-
-// Used to choose between perfect forwarding or pass-by-value. Pass-by-value is
-// faster for types that can be passed in registers.
-template <typename _Tp>
-using __fast_forward = __conditional_t<is_scalar<_Tp>::value, _Tp, _Tp&&>;
-
-// __policy_invoker calls an instance of __alloc_func held in __policy_storage.
-
-template <class _Fp>
-struct __policy_invoker;
-
-template <class _Rp, class... _ArgTypes>
-struct __policy_invoker<_Rp(_ArgTypes...)> {
- typedef _Rp (*__Call)(const __policy_storage*, __fast_forward<_ArgTypes>...);
-
- __Call __call_;
-
- // Creates an invoker that throws bad_function_call.
- _LIBCPP_HIDE_FROM_ABI __policy_invoker() : __call_(&__call_empty) {}
-
- // Creates an invoker that calls the given instance of __func.
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static __policy_invoker __create() {
- return __policy_invoker(&__call_impl<_Fun>);
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {}
-
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) {
- __throw_bad_function_call();
- }
-
- template <typename _Fun>
- _LIBCPP_HIDE_FROM_ABI static _Rp __call_impl(const __policy_storage* __buf, __fast_forward<_ArgTypes>... __args) {
- _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value ? &__buf->__small : __buf->__large);
- return (*__f)(std::forward<_ArgTypes>(__args)...);
- }
-};
-
-// __policy_func uses a __policy and __policy_invoker to create a type-erased,
-// copyable functor.
-
-template <class _Fp>
-class __policy_func;
-
-template <class _Rp, class... _ArgTypes>
-class __policy_func<_Rp(_ArgTypes...)> {
- // Inline storage for small objects.
- __policy_storage __buf_;
-
- // Calls the value stored in __buf_. This could technically be part of
- // policy, but storing it here eliminates a level of indirection inside
- // operator().
- typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker;
- __invoker __invoker_;
-
- // The policy that describes how to move / copy / destroy __buf_. Never
- // null, even if the function is empty.
- const __policy* __policy_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __policy_func() : __policy_(__policy::__create_empty()) {}
-
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI __policy_func(_Fp&& __f, const _Alloc& __a) : __policy_(__policy::__create_empty()) {
- typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_alloc<__alloc_traits, _Fun> _FunAlloc;
-
- if (__function::__not_null(__f)) {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
-
- _FunAlloc __af(__a);
- if (__use_small_storage<_Fun>()) {
- ::new ((void*)&__buf_.__small) _Fun(std::move(__f), _Alloc(__af));
- } else {
- typedef __allocator_destructor<_FunAlloc> _Dp;
- unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1));
- ::new ((void*)__hold.get()) _Fun(std::move(__f), _Alloc(__af));
- __buf_.__large = __hold.release();
- }
- }
- }
-
- template <class _Fp, __enable_if_t<!is_same<__decay_t<_Fp>, __policy_func>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) {
- typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun;
-
- if (__function::__not_null(__f)) {
- __invoker_ = __invoker::template __create<_Fun>();
- __policy_ = __policy::__create<_Fun>();
- if (__use_small_storage<_Fun>()) {
- ::new ((void*)&__buf_.__small) _Fun(std::move(__f));
- } else {
- __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<_Fun>(1);
- __buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
- (void)__hold.release();
- }
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI __policy_func(const __policy_func& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
- if (__policy_->__clone)
- __buf_.__large = __policy_->__clone(__f.__buf_.__large);
- }
-
- _LIBCPP_HIDE_FROM_ABI __policy_func(__policy_func&& __f)
- : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) {
- if (__policy_->__destroy) {
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__policy_func() {
- if (__policy_->__destroy)
- __policy_->__destroy(__buf_.__large);
- }
-
- _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(__policy_func&& __f) {
- *this = nullptr;
- __buf_ = __f.__buf_;
- __invoker_ = __f.__invoker_;
- __policy_ = __f.__policy_;
- __f.__policy_ = __policy::__create_empty();
- __f.__invoker_ = __invoker();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI __policy_func& operator=(nullptr_t) {
- const __policy* __p = __policy_;
- __policy_ = __policy::__create_empty();
- __invoker_ = __invoker();
- if (__p->__destroy)
- __p->__destroy(__buf_.__large);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
- return __invoker_.__call_(std::addressof(__buf_), std::forward<_ArgTypes>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(__policy_func& __f) {
- std::swap(__invoker_, __f.__invoker_);
- std::swap(__policy_, __f.__policy_);
- std::swap(__buf_, __f.__buf_);
- }
-
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return !__policy_->__is_null; }
-
-# ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT { return *__policy_->__type_info; }
-
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT {
- if (__policy_->__is_null || typeid(_Tp) != *__policy_->__type_info)
- return nullptr;
- if (__policy_->__clone) // Out of line storage.
- return reinterpret_cast<const _Tp*>(__buf_.__large);
- else
- return reinterpret_cast<const _Tp*>(&__buf_.__small);
- }
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-# if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
-
-extern "C" void* _Block_copy(const void*);
-extern "C" void _Block_release(const void*);
-
-template <class _Rp1, class... _ArgTypes1, class _Alloc, class _Rp, class... _ArgTypes>
-class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
- typedef _Rp1 (^__block_type)(_ArgTypes1...);
- __block_type __f_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type const& __f)
-# ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-# else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-# endif
- {
- }
-
- // [TODO] add && to save on a retain
-
- _LIBCPP_HIDE_FROM_ABI explicit __func(__block_type __f, const _Alloc& /* unused */)
-# ifdef _LIBCPP_HAS_OBJC_ARC
- : __f_(__f)
-# else
- : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
-# endif
- {
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual __base<_Rp(_ArgTypes...)>* __clone() const {
- _LIBCPP_ASSERT_INTERNAL(
- false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- return nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
- ::new ((void*)__p) __func(__f_);
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT {
-# ifndef _LIBCPP_HAS_OBJC_ARC
- if (__f_)
- _Block_release(__f_);
-# endif
- __f_ = 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT {
- _LIBCPP_ASSERT_INTERNAL(
- false,
- "Block pointers are just pointers, so they should always fit into "
- "std::function's small buffer optimization. This function should "
- "never be invoked.");
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg) {
- return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...);
- }
-
-# ifndef _LIBCPP_HAS_NO_RTTI
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(type_info const& __ti) const _NOEXCEPT {
- if (__ti == typeid(__func::__block_type))
- return &__f_;
- return (const void*)nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT {
- return typeid(__func::__block_type);
- }
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-# endif // _LIBCPP_HAS_EXTENSION_BLOCKS
-
-} // namespace __function
-
-template <class _Rp, class... _ArgTypes>
-class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
- : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
- public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> {
-# ifndef _LIBCPP_ABI_OPTIMIZED_FUNCTION
- typedef __function::__value_func<_Rp(_ArgTypes...)> __func;
-# else
- typedef __function::__policy_func<_Rp(_ArgTypes...)> __func;
-# endif
-
- __func __f_;
-
- template <class _Fp,
- bool = _And< _IsNotSame<__remove_cvref_t<_Fp>, function>, __invokable<_Fp, _ArgTypes...> >::value>
- struct __callable;
- template <class _Fp>
- struct __callable<_Fp, true> {
- static const bool value =
- is_void<_Rp>::value || __is_core_convertible<typename __invoke_of<_Fp, _ArgTypes...>::type, _Rp>::value;
- };
- template <class _Fp>
- struct __callable<_Fp, false> {
- static const bool value = false;
- };
-
- template <class _Fp>
- using _EnableIfLValueCallable = __enable_if_t<__callable<_Fp&>::value>;
-
-public:
- typedef _Rp result_type;
-
- // construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI function() _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI function(nullptr_t) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI function(const function&);
- _LIBCPP_HIDE_FROM_ABI function(function&&) _NOEXCEPT;
- template <class _Fp, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(_Fp);
-
-# if _LIBCPP_STD_VER <= 14
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, const function&);
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc&, function&&);
- template <class _Fp, class _Alloc, class = _EnableIfLValueCallable<_Fp>>
- _LIBCPP_HIDE_FROM_ABI function(allocator_arg_t, const _Alloc& __a, _Fp __f);
-# endif
-
- _LIBCPP_HIDE_FROM_ABI function& operator=(const function&);
- _LIBCPP_HIDE_FROM_ABI function& operator=(function&&) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI function& operator=(nullptr_t) _NOEXCEPT;
- template <class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
- _LIBCPP_HIDE_FROM_ABI function& operator=(_Fp&&);
-
- _LIBCPP_HIDE_FROM_ABI ~function();
-
- // function modifiers:
- _LIBCPP_HIDE_FROM_ABI void swap(function&) _NOEXCEPT;
-
-# if _LIBCPP_STD_VER <= 14
- template <class _Fp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI void assign(_Fp&& __f, const _Alloc& __a) {
- function(allocator_arg, __a, std::forward<_Fp>(__f)).swap(*this);
- }
-# endif
-
- // function capacity:
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return static_cast<bool>(__f_); }
-
- // deleted overloads close possible hole in the type system
- template <class _R2, class... _ArgTypes2>
- bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
-# if _LIBCPP_STD_VER <= 17
- template <class _R2, class... _ArgTypes2>
- bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
-# endif
-
-public:
- // function invocation:
- _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
-
-# ifndef _LIBCPP_HAS_NO_RTTI
- // function target access:
- _LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
-# endif // _LIBCPP_HAS_NO_RTTI
-};
-
-# if _LIBCPP_STD_VER >= 17
-template <class _Rp, class... _Ap>
-function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>;
-
-template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
-function(_Fp) -> function<_Stripped>;
-# endif // _LIBCPP_STD_VER >= 17
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {}
-
-# if _LIBCPP_STD_VER <= 14
-template <class _Rp, class... _ArgTypes>
-template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, const function& __f) : __f_(__f.__f_) {}
-# endif
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT : __f_(std::move(__f.__f_)) {}
-
-# if _LIBCPP_STD_VER <= 14
-template <class _Rp, class... _ArgTypes>
-template <class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, function&& __f) : __f_(std::move(__f.__f_)) {}
-# endif
-
-template <class _Rp, class... _ArgTypes>
-template <class _Fp, class>
-function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(std::move(__f)) {}
-
-# if _LIBCPP_STD_VER <= 14
-template <class _Rp, class... _ArgTypes>
-template <class _Fp, class _Alloc, class>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a, _Fp __f) : __f_(std::move(__f), __a) {}
-# endif
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(const function& __f) {
- function(__f).swap(*this);
- return *this;
-}
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT {
- __f_ = std::move(__f.__f_);
- return *this;
-}
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT {
- __f_ = nullptr;
- return *this;
-}
-
-template <class _Rp, class... _ArgTypes>
-template <class _Fp, class>
-function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) {
- function(std::forward<_Fp>(__f)).swap(*this);
- return *this;
-}
-
-template <class _Rp, class... _ArgTypes>
-function<_Rp(_ArgTypes...)>::~function() {}
-
-template <class _Rp, class... _ArgTypes>
-void function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT {
- __f_.swap(__f.__f_);
-}
-
-template <class _Rp, class... _ArgTypes>
-_Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
- return __f_(std::forward<_ArgTypes>(__arg)...);
-}
-
-# ifndef _LIBCPP_HAS_NO_RTTI
-
-template <class _Rp, class... _ArgTypes>
-const std::type_info& function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
- return __f_.target_type();
-}
-
-template <class _Rp, class... _ArgTypes>
-template <typename _Tp>
-_Tp* function<_Rp(_ArgTypes...)>::target() _NOEXCEPT {
- return (_Tp*)(__f_.template target<_Tp>());
-}
-
-template <class _Rp, class... _ArgTypes>
-template <typename _Tp>
-const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT {
- return __f_.template target<_Tp>();
-}
-
-# endif // _LIBCPP_HAS_NO_RTTI
-
-template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
- return !__f;
-}
-
-# if _LIBCPP_STD_VER <= 17
-
-template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
- return !__f;
-}
-
-template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {
- return (bool)__f;
-}
-
-template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {
- return (bool)__f;
-}
-
-# endif // _LIBCPP_STD_VER <= 17
-
-template <class _Rp, class... _ArgTypes>
-inline _LIBCPP_HIDE_FROM_ABI void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {
- return __x.swap(__y);
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_FUNCTION_H
diff --git a/libcxx/include/__cxx03/__functional/invoke.h b/libcxx/include/__cxx03/__functional/invoke.h
deleted file mode 100644
index d17a2d58e471f..0000000000000
--- a/libcxx/include/__cxx03/__functional/invoke.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_INVOKE_H
-#define _LIBCPP___CXX03___FUNCTIONAL_INVOKE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/invoke.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Fn, class... _Args>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
-invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
- return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#if _LIBCPP_STD_VER >= 23
-template <class _Result, class _Fn, class... _Args>
- requires is_invocable_r_v<_Result, _Fn, _Args...>
-_LIBCPP_HIDE_FROM_ABI constexpr _Result
-invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) {
- if constexpr (is_void_v<_Result>) {
- static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...));
- } else {
- // TODO: Use reference_converts_from_temporary_v once implemented
- // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>;
- // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>,
- static_assert(true,
- "Returning from invoke_r would bind a temporary object to the reference return type, "
- "which would result in a dangling reference.");
- return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
- }
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_INVOKE_H
diff --git a/libcxx/include/__cxx03/__functional/is_transparent.h b/libcxx/include/__cxx03/__functional/is_transparent.h
deleted file mode 100644
index b630aca633672..0000000000000
--- a/libcxx/include/__cxx03/__functional/is_transparent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_IS_TRANSPARENT
-#define _LIBCPP___CXX03___FUNCTIONAL_IS_TRANSPARENT
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/void_t.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, class, class = void>
-inline const bool __is_transparent_v = false;
-
-template <class _Tp, class _Up>
-inline const bool __is_transparent_v<_Tp, _Up, __void_t<typename _Tp::is_transparent> > = true;
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_IS_TRANSPARENT
diff --git a/libcxx/include/__cxx03/__functional/mem_fn.h b/libcxx/include/__cxx03/__functional/mem_fn.h
index b3257f8302f1b..4577c41bf8499 100644
--- a/libcxx/include/__cxx03/__functional/mem_fn.h
+++ b/libcxx/include/__cxx03/__functional/mem_fn.h
@@ -12,8 +12,8 @@
#include <__cxx03/__config>
#include <__cxx03/__functional/binary_function.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__functional/weak_result_type.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__utility/forward.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__functional/not_fn.h b/libcxx/include/__cxx03/__functional/not_fn.h
deleted file mode 100644
index a6c648bc0beb2..0000000000000
--- a/libcxx/include/__cxx03/__functional/not_fn.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_NOT_FN_H
-#define _LIBCPP___CXX03___FUNCTIONAL_NOT_FN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/perfect_forward.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-struct __not_fn_op {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto operator()(_Args&&... __args) const
- noexcept(noexcept(!std::invoke(std::forward<_Args>(__args)...)))
- -> decltype(!std::invoke(std::forward<_Args>(__args)...)) {
- return !std::invoke(std::forward<_Args>(__args)...);
- }
-};
-
-template <class _Fn>
-struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
- using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
-};
-
-template <class _Fn,
- class = enable_if_t< is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> >>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto not_fn(_Fn&& __f) {
- return __not_fn_t<decay_t<_Fn>>(std::forward<_Fn>(__f));
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_NOT_FN_H
diff --git a/libcxx/include/__cxx03/__functional/perfect_forward.h b/libcxx/include/__cxx03/__functional/perfect_forward.h
deleted file mode 100644
index 230e0dc21b429..0000000000000
--- a/libcxx/include/__cxx03/__functional/perfect_forward.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_PERFECT_FORWARD_H
-#define _LIBCPP___CXX03___FUNCTIONAL_PERFECT_FORWARD_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/invoke.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Op, class _Indices, class... _BoundArgs>
-struct __perfect_forward_impl;
-
-template <class _Op, size_t... _Idx, class... _BoundArgs>
-struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _BoundArgs...> {
-private:
- tuple<_BoundArgs...> __bound_args_;
-
-public:
- template <class... _Args, class = enable_if_t< is_constructible_v<tuple<_BoundArgs...>, _Args&&...> >>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __perfect_forward_impl(_Args&&... __bound_args)
- : __bound_args_(std::forward<_Args>(__bound_args)...) {}
-
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl(__perfect_forward_impl&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
-
- template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) & noexcept(
- noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
- return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
- }
-
- template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs&..., _Args...>>>
- auto operator()(_Args&&...) & = delete;
-
- template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const& noexcept(
- noexcept(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)))
- -> decltype(_Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...)) {
- return _Op()(std::get<_Idx>(__bound_args_)..., std::forward<_Args>(__args)...);
- }
-
- template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const&..., _Args...>>>
- auto operator()(_Args&&...) const& = delete;
-
- template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) && noexcept(
- noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
- return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
- }
-
- template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs..., _Args...>>>
- auto operator()(_Args&&...) && = delete;
-
- template <class... _Args, class = enable_if_t<is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&& noexcept(
- noexcept(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)))
- -> decltype(_Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...)) {
- return _Op()(std::get<_Idx>(std::move(__bound_args_))..., std::forward<_Args>(__args)...);
- }
-
- template <class... _Args, class = enable_if_t<!is_invocable_v<_Op, _BoundArgs const..., _Args...>>>
- auto operator()(_Args&&...) const&& = delete;
-};
-
-// __perfect_forward implements a perfect-forwarding call wrapper as explained in [func.require].
-template <class _Op, class... _Args>
-using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>;
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_PERFECT_FORWARD_H
diff --git a/libcxx/include/__cxx03/__functional/ranges_operations.h b/libcxx/include/__cxx03/__functional/ranges_operations.h
deleted file mode 100644
index e48593824852d..0000000000000
--- a/libcxx/include/__cxx03/__functional/ranges_operations.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H
-#define _LIBCPP___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H
-
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/totally_ordered.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/desugars_to.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-struct equal_to {
- template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {
- return std::forward<_Tp>(__t) == std::forward<_Up>(__u);
- }
-
- using is_transparent = void;
-};
-
-struct not_equal_to {
- template <class _Tp, class _Up>
- requires equality_comparable_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {
- return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));
- }
-
- using is_transparent = void;
-};
-
-struct less {
- template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {
- return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
- }
-
- using is_transparent = void;
-};
-
-struct less_equal {
- template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {
- return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));
- }
-
- using is_transparent = void;
-};
-
-struct greater {
- template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {
- return std::forward<_Up>(__u) < std::forward<_Tp>(__t);
- }
-
- using is_transparent = void;
-};
-
-struct greater_equal {
- template <class _Tp, class _Up>
- requires totally_ordered_with<_Tp, _Up>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {
- return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));
- }
-
- using is_transparent = void;
-};
-
-} // namespace ranges
-
-// For ranges we do not require that the types on each side of the equality
-// operator are of the same type
-template <class _Tp, class _Up>
-inline const bool __desugars_to_v<__equal_tag, ranges::equal_to, _Tp, _Up> = true;
-
-template <class _Tp, class _Up>
-inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H
diff --git a/libcxx/include/__cxx03/__functional/reference_wrapper.h b/libcxx/include/__cxx03/__functional/reference_wrapper.h
index e217bdf543351..2e37464414e1b 100644
--- a/libcxx/include/__cxx03/__functional/reference_wrapper.h
+++ b/libcxx/include/__cxx03/__functional/reference_wrapper.h
@@ -10,13 +10,11 @@
#ifndef _LIBCPP___CXX03___FUNCTIONAL_REFERENCE_WRAPPER_H
#define _LIBCPP___CXX03___FUNCTIONAL_REFERENCE_WRAPPER_H
-#include <__cxx03/__compare/synth_three_way.h>
-#include <__cxx03/__concepts/boolean_testable.h>
#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__functional/weak_result_type.h>
#include <__cxx03/__memory/addressof.h>
#include <__cxx03/__type_traits/enable_if.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_const.h>
#include <__cxx03/__type_traits/remove_cvref.h>
#include <__cxx03/__type_traits/void_t.h>
diff --git a/libcxx/include/__cxx03/__functional/weak_result_type.h b/libcxx/include/__cxx03/__functional/weak_result_type.h
index 539989dda2d97..77c2f5f054915 100644
--- a/libcxx/include/__cxx03/__functional/weak_result_type.h
+++ b/libcxx/include/__cxx03/__functional/weak_result_type.h
@@ -12,9 +12,9 @@
#include <__cxx03/__config>
#include <__cxx03/__functional/binary_function.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__functional/unary_function.h>
#include <__cxx03/__type_traits/integral_constant.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_same.h>
#include <__cxx03/__utility/declval.h>
diff --git a/libcxx/include/__cxx03/__fwd/format.h b/libcxx/include/__cxx03/__fwd/format.h
deleted file mode 100644
index 3da3fd728266b..0000000000000
--- a/libcxx/include/__cxx03/__fwd/format.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___FWD_FORMAT_H
-#define _LIBCPP___CXX03___FWD_FORMAT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.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 _Context>
-class _LIBCPP_TEMPLATE_VIS basic_format_arg;
-
-template <class _OutIt, class _CharT>
- requires output_iterator<_OutIt, const _CharT&>
-class _LIBCPP_TEMPLATE_VIS basic_format_context;
-
-template <class _Tp, class _CharT = char>
-struct _LIBCPP_TEMPLATE_VIS formatter;
-
-#endif //_LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FWD_FORMAT_H
diff --git a/libcxx/include/__cxx03/__fwd/mdspan.h b/libcxx/include/__cxx03/__fwd/mdspan.h
deleted file mode 100644
index 50209798a1443..0000000000000
--- a/libcxx/include/__cxx03/__fwd/mdspan.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_LAYOUTS_H
-#define _LIBCPP___CXX03___MDSPAN_LAYOUTS_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-// Layout policy with a mapping which corresponds to FORTRAN-style array layouts
-struct layout_left {
- template <class _Extents>
- class mapping;
-};
-
-// Layout policy with a mapping which corresponds to C-style array layouts
-struct layout_right {
- template <class _Extents>
- class mapping;
-};
-
-// Layout policy with a unique mapping where strides are arbitrary
-struct layout_stride {
- template <class _Extents>
- class mapping;
-};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_LAYOUTS_H
diff --git a/libcxx/include/__cxx03/__fwd/memory_resource.h b/libcxx/include/__cxx03/__fwd/memory_resource.h
deleted file mode 100644
index aefa00a12a835..0000000000000
--- a/libcxx/include/__cxx03/__fwd/memory_resource.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___FWD_MEMORY_RESOURCE_H
-#define _LIBCPP___CXX03___FWD_MEMORY_RESOURCE_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-template <class _ValueType>
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator;
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___FWD_MEMORY_RESOURCE_H
diff --git a/libcxx/include/__cxx03/__fwd/span.h b/libcxx/include/__cxx03/__fwd/span.h
deleted file mode 100644
index 415a3c5ba8a55..0000000000000
--- a/libcxx/include/__cxx03/__fwd/span.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// -*- C++ -*-
-//===---------------------------------------------------------------------===//
-//
-// 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___CXX03___FWD_SPAN_H
-#define _LIBCPP___CXX03___FWD_SPAN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-template <typename _Tp, size_t _Extent = dynamic_extent>
-class span;
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___FWD_SPAN_H
diff --git a/libcxx/include/__cxx03/__fwd/string.h b/libcxx/include/__cxx03/__fwd/string.h
index 21c2584c6e95b..4f2569e44283b 100644
--- a/libcxx/include/__cxx03/__fwd/string.h
+++ b/libcxx/include/__cxx03/__fwd/string.h
@@ -11,7 +11,6 @@
#include <__cxx03/__config>
#include <__cxx03/__fwd/memory.h>
-#include <__cxx03/__fwd/memory_resource.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__fwd/subrange.h b/libcxx/include/__cxx03/__fwd/subrange.h
deleted file mode 100644
index 34ba3504d0499..0000000000000
--- a/libcxx/include/__cxx03/__fwd/subrange.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//===---------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___FWD_SUBRANGE_H
-#define _LIBCPP___CXX03___FWD_SUBRANGE_H
-
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-enum class subrange_kind : bool { unsized, sized };
-
-template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent, subrange_kind _Kind>
- requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
-class _LIBCPP_TEMPLATE_VIS subrange;
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>&);
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires(_Index < 2)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&&);
-
-} // namespace ranges
-
-using ranges::get;
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___FWD_SUBRANGE_H
diff --git a/libcxx/include/__cxx03/__hash_table b/libcxx/include/__cxx03/__hash_table
index 4a27681442c27..a4eff8c654f11 100644
--- a/libcxx/include/__cxx03/__hash_table
+++ b/libcxx/include/__cxx03/__hash_table
@@ -16,7 +16,6 @@
#include <__cxx03/__bit/countl.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
#include <__cxx03/__memory/allocator_traits.h>
@@ -42,7 +41,6 @@
#include <__cxx03/__utility/swap.h>
#include <__cxx03/cmath>
#include <__cxx03/cstring>
-#include <__cxx03/initializer_list>
#include <__cxx03/new> // __launder
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__iterator/advance.h b/libcxx/include/__cxx03/__iterator/advance.h
index ac4904829b7ee..df85a4faf3fd2 100644
--- a/libcxx/include/__cxx03/__iterator/advance.h
+++ b/libcxx/include/__cxx03/__iterator/advance.h
@@ -11,11 +11,7 @@
#define _LIBCPP___CXX03___ITERATOR_ADVANCE_H
#include <__cxx03/__assert>
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/same_as.h>
#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/enable_if.h>
#include <__cxx03/__type_traits/is_integral.h>
diff --git a/libcxx/include/__cxx03/__iterator/bounded_iter.h b/libcxx/include/__cxx03/__iterator/bounded_iter.h
index d361e74283de7..9148a81b848ea 100644
--- a/libcxx/include/__cxx03/__iterator/bounded_iter.h
+++ b/libcxx/include/__cxx03/__iterator/bounded_iter.h
@@ -11,8 +11,6 @@
#define _LIBCPP___CXX03___ITERATOR_BOUNDED_ITER_H
#include <__cxx03/__assert>
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/three_way_comparable.h>
#include <__cxx03/__config>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/pointer_traits.h>
diff --git a/libcxx/include/__cxx03/__iterator/common_iterator.h b/libcxx/include/__cxx03/__iterator/common_iterator.h
deleted file mode 100644
index 6083a23e67a86..0000000000000
--- a/libcxx/include/__cxx03/__iterator/common_iterator.h
+++ /dev/null
@@ -1,299 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_COMMON_ITERATOR_H
-#define _LIBCPP___CXX03___ITERATOR_COMMON_ITERATOR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/variant>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Iter>
-concept __can_use_postfix_proxy =
- constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>> && move_constructible<iter_value_t<_Iter>>;
-
-template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
- requires(!same_as<_Iter, _Sent> && copyable<_Iter>)
-class common_iterator {
- struct __proxy {
- _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>* operator->() const noexcept {
- return std::addressof(__value_);
- }
- iter_value_t<_Iter> __value_;
- };
-
- struct __postfix_proxy {
- _LIBCPP_HIDE_FROM_ABI constexpr const iter_value_t<_Iter>& operator*() const noexcept { return __value_; }
- iter_value_t<_Iter> __value_;
- };
-
- variant<_Iter, _Sent> __hold_;
- template <input_or_output_iterator _OtherIter, sentinel_for<_OtherIter> _OtherSent>
- requires(!same_as<_OtherIter, _OtherSent> && copyable<_OtherIter>)
- friend class common_iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI common_iterator()
- requires default_initializable<_Iter>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Iter __i) : __hold_(in_place_type<_Iter>, std::move(__i)) {}
- _LIBCPP_HIDE_FROM_ABI constexpr common_iterator(_Sent __s) : __hold_(in_place_type<_Sent>, std::move(__s)) {}
-
- template <class _I2, class _S2>
- requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr common_iterator(const common_iterator<_I2, _S2>& __other)
- : __hold_([&]() -> variant<_Iter, _Sent> {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__other.__hold_.valueless_by_exception(), "Attempted to construct from a valueless common_iterator");
- if (__other.__hold_.index() == 0)
- return variant<_Iter, _Sent>{in_place_index<0>, std::__unchecked_get<0>(__other.__hold_)};
- return variant<_Iter, _Sent>{in_place_index<1>, std::__unchecked_get<1>(__other.__hold_)};
- }()) {}
-
- template <class _I2, class _S2>
- requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> &&
- assignable_from<_Iter&, const _I2&> && assignable_from<_Sent&, const _S2&>
- _LIBCPP_HIDE_FROM_ABI common_iterator& operator=(const common_iterator<_I2, _S2>& __other) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__other.__hold_.valueless_by_exception(), "Attempted to assign from a valueless common_iterator");
-
- auto __idx = __hold_.index();
- auto __other_idx = __other.__hold_.index();
-
- // If they're the same index, just assign.
- if (__idx == 0 && __other_idx == 0)
- std::__unchecked_get<0>(__hold_) = std::__unchecked_get<0>(__other.__hold_);
- else if (__idx == 1 && __other_idx == 1)
- std::__unchecked_get<1>(__hold_) = std::__unchecked_get<1>(__other.__hold_);
-
- // Otherwise replace with the oposite element.
- else if (__other_idx == 1)
- __hold_.template emplace<1>(std::__unchecked_get<1>(__other.__hold_));
- else if (__other_idx == 0)
- __hold_.template emplace<0>(std::__unchecked_get<0>(__other.__hold_));
-
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
- return *std::__unchecked_get<_Iter>(__hold_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
- requires __dereferenceable<const _Iter>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
- return *std::__unchecked_get<_Iter>(__hold_);
- }
-
- template <class _I2 = _Iter>
- _LIBCPP_HIDE_FROM_ABI auto operator->() const
- requires indirectly_readable<const _I2> && (requires(const _I2& __i) {
- __i.operator->();
- } || is_reference_v<iter_reference_t<_I2>> || constructible_from<iter_value_t<_I2>, iter_reference_t<_I2>>)
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
- if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) {
- return std::__unchecked_get<_Iter>(__hold_);
- } else if constexpr (is_reference_v<iter_reference_t<_Iter>>) {
- auto&& __tmp = *std::__unchecked_get<_Iter>(__hold_);
- return std::addressof(__tmp);
- } else {
- return __proxy{*std::__unchecked_get<_Iter>(__hold_)};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI common_iterator& operator++() {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
- ++std::__unchecked_get<_Iter>(__hold_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator");
- if constexpr (forward_iterator<_Iter>) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- } else if constexpr (requires(_Iter& __i) {
- { *__i++ } -> __can_reference;
- } || !__can_use_postfix_proxy<_Iter>) {
- return std::__unchecked_get<_Iter>(__hold_)++;
- } else {
- auto __p = __postfix_proxy{**this};
- ++*this;
- return __p;
- }
- }
-
- template <class _I2, sentinel_for<_Iter> _S2>
- requires sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
-
- auto __x_index = __x.__hold_.index();
- auto __y_index = __y.__hold_.index();
-
- if (__x_index == __y_index)
- return true;
-
- if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
-
- return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
- }
-
- template <class _I2, sentinel_for<_Iter> _S2>
- requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator");
-
- auto __x_index = __x.__hold_.index();
- auto __y_index = __y.__hold_.index();
-
- if (__x_index == 1 && __y_index == 1)
- return true;
-
- if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
-
- if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) == std::__unchecked_get<_S2>(__y.__hold_);
-
- return std::__unchecked_get<_Sent>(__x.__hold_) == std::__unchecked_get<_I2>(__y.__hold_);
- }
-
- template <sized_sentinel_for<_Iter> _I2, sized_sentinel_for<_Iter> _S2>
- requires sized_sentinel_for<_Sent, _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
- operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator");
-
- auto __x_index = __x.__hold_.index();
- auto __y_index = __y.__hold_.index();
-
- if (__x_index == 1 && __y_index == 1)
- return 0;
-
- if (__x_index == 0 && __y_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
-
- if (__x_index == 0)
- return std::__unchecked_get<_Iter>(__x.__hold_) - std::__unchecked_get<_S2>(__y.__hold_);
-
- return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
- iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
- requires input_iterator<_Iter>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
- return ranges::iter_move(std::__unchecked_get<_Iter>(__i.__hold_));
- }
-
- template <indirectly_swappable<_Iter> _I2, class _S2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr void
- iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) noexcept(
- noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>()))) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
- return ranges::iter_swap(std::__unchecked_get<_Iter>(__x.__hold_), std::__unchecked_get<_I2>(__y.__hold_));
- }
-};
-
-template <class _Iter, class _Sent>
-struct incrementable_traits<common_iterator<_Iter, _Sent>> {
- using difference_type = iter_difference_t<_Iter>;
-};
-
-template <class _Iter>
-concept __denotes_forward_iter = requires {
- typename iterator_traits<_Iter>::iterator_category;
-} && derived_from<typename iterator_traits<_Iter>::iterator_category, forward_iterator_tag>;
-
-template <class _Iter, class _Sent>
-concept __common_iter_has_ptr_op = requires(const common_iterator<_Iter, _Sent>& __a) { __a.operator->(); };
-
-template <class, class>
-struct __arrow_type_or_void {
- using type = void;
-};
-
-template <class _Iter, class _Sent>
- requires __common_iter_has_ptr_op<_Iter, _Sent>
-struct __arrow_type_or_void<_Iter, _Sent> {
- using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
-};
-
-template <input_iterator _Iter, class _Sent>
-struct iterator_traits<common_iterator<_Iter, _Sent>> {
- using iterator_concept = _If<forward_iterator<_Iter>, forward_iterator_tag, input_iterator_tag>;
- using iterator_category = _If<__denotes_forward_iter<_Iter>, forward_iterator_tag, input_iterator_tag>;
- using pointer = typename __arrow_type_or_void<_Iter, _Sent>::type;
- using value_type = iter_value_t<_Iter>;
- using difference_type = iter_difference_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_COMMON_ITERATOR_H
diff --git a/libcxx/include/__cxx03/__iterator/concepts.h b/libcxx/include/__cxx03/__iterator/concepts.h
deleted file mode 100644
index af7d0c9a0541d..0000000000000
--- a/libcxx/include/__cxx03/__iterator/concepts.h
+++ /dev/null
@@ -1,257 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_CONCEPTS_H
-#define _LIBCPP___CXX03___ITERATOR_CONCEPTS_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/common_reference_with.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__concepts/predicate.h>
-#include <__cxx03/__concepts/regular.h>
-#include <__cxx03/__concepts/relation.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__concepts/totally_ordered.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [iterator.concept.readable]
-template <class _In>
-concept __indirectly_readable_impl =
- requires(const _In __i) {
- typename iter_value_t<_In>;
- typename iter_reference_t<_In>;
- typename iter_rvalue_reference_t<_In>;
- { *__i } -> same_as<iter_reference_t<_In>>;
- { ranges::iter_move(__i) } -> same_as<iter_rvalue_reference_t<_In>>;
- } && common_reference_with<iter_reference_t<_In>&&, iter_value_t<_In>&> &&
- common_reference_with<iter_reference_t<_In>&&, iter_rvalue_reference_t<_In>&&> &&
- common_reference_with<iter_rvalue_reference_t<_In>&&, const iter_value_t<_In>&>;
-
-template <class _In>
-concept indirectly_readable = __indirectly_readable_impl<remove_cvref_t<_In>>;
-
-template <indirectly_readable _Tp>
-using iter_common_reference_t = common_reference_t<iter_reference_t<_Tp>, iter_value_t<_Tp>&>;
-
-// [iterator.concept.writable]
-template <class _Out, class _Tp>
-concept indirectly_writable = requires(_Out&& __o, _Tp&& __t) {
- *__o = std::forward<_Tp>(__t); // not required to be equality-preserving
- *std::forward<_Out>(__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*__o) = std::forward<_Tp>(__t); // not required to be equality-preserving
- const_cast<const iter_reference_t<_Out>&&>(*std::forward<_Out>(__o)) =
- std::forward<_Tp>(__t); // not required to be equality-preserving
-};
-
-// [iterator.concept.winc]
-template <class _Tp>
-concept __integer_like = integral<_Tp> && !same_as<_Tp, bool>;
-
-template <class _Tp>
-concept __signed_integer_like = signed_integral<_Tp>;
-
-template <class _Ip>
-concept weakly_incrementable =
- // TODO: remove this once the clang bug is fixed (bugs.llvm.org/PR48173).
- !same_as<_Ip, bool> && // Currently, clang does not handle bool correctly.
- movable<_Ip> && requires(_Ip __i) {
- typename iter_difference_t<_Ip>;
- requires __signed_integer_like<iter_difference_t<_Ip>>;
- { ++__i } -> same_as<_Ip&>; // not required to be equality-preserving
- __i++; // not required to be equality-preserving
- };
-
-// [iterator.concept.inc]
-template <class _Ip>
-concept incrementable = regular<_Ip> && weakly_incrementable<_Ip> && requires(_Ip __i) {
- { __i++ } -> same_as<_Ip>;
-};
-
-// [iterator.concept.iterator]
-template <class _Ip>
-concept input_or_output_iterator = requires(_Ip __i) {
- { *__i } -> __can_reference;
-} && weakly_incrementable<_Ip>;
-
-// [iterator.concept.sentinel]
-template <class _Sp, class _Ip>
-concept sentinel_for = semiregular<_Sp> && input_or_output_iterator<_Ip> && __weakly_equality_comparable_with<_Sp, _Ip>;
-
-template <class, class>
-inline constexpr bool disable_sized_sentinel_for = false;
-
-template <class _Sp, class _Ip>
-concept sized_sentinel_for =
- sentinel_for<_Sp, _Ip> && !disable_sized_sentinel_for<remove_cv_t<_Sp>, remove_cv_t<_Ip>> &&
- requires(const _Ip& __i, const _Sp& __s) {
- { __s - __i } -> same_as<iter_difference_t<_Ip>>;
- { __i - __s } -> same_as<iter_difference_t<_Ip>>;
- };
-
-// [iterator.concept.input]
-template <class _Ip>
-concept input_iterator = input_or_output_iterator<_Ip> && indirectly_readable<_Ip> && requires {
- typename _ITER_CONCEPT<_Ip>;
-} && derived_from<_ITER_CONCEPT<_Ip>, input_iterator_tag>;
-
-// [iterator.concept.output]
-template <class _Ip, class _Tp>
-concept output_iterator =
- input_or_output_iterator<_Ip> && indirectly_writable<_Ip, _Tp> && requires(_Ip __it, _Tp&& __t) {
- *__it++ = std::forward<_Tp>(__t); // not required to be equality-preserving
- };
-
-// [iterator.concept.forward]
-template <class _Ip>
-concept forward_iterator =
- input_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, forward_iterator_tag> && incrementable<_Ip> &&
- sentinel_for<_Ip, _Ip>;
-
-// [iterator.concept.bidir]
-template <class _Ip>
-concept bidirectional_iterator =
- forward_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, bidirectional_iterator_tag> && requires(_Ip __i) {
- { --__i } -> same_as<_Ip&>;
- { __i-- } -> same_as<_Ip>;
- };
-
-template <class _Ip>
-concept random_access_iterator =
- bidirectional_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, random_access_iterator_tag> &&
- totally_ordered<_Ip> && sized_sentinel_for<_Ip, _Ip> &&
- requires(_Ip __i, const _Ip __j, const iter_difference_t<_Ip> __n) {
- { __i += __n } -> same_as<_Ip&>;
- { __j + __n } -> same_as<_Ip>;
- { __n + __j } -> same_as<_Ip>;
- { __i -= __n } -> same_as<_Ip&>;
- { __j - __n } -> same_as<_Ip>;
- { __j[__n] } -> same_as<iter_reference_t<_Ip>>;
- };
-
-template <class _Ip>
-concept contiguous_iterator =
- random_access_iterator<_Ip> && derived_from<_ITER_CONCEPT<_Ip>, contiguous_iterator_tag> &&
- is_lvalue_reference_v<iter_reference_t<_Ip>> && same_as<iter_value_t<_Ip>, remove_cvref_t<iter_reference_t<_Ip>>> &&
- requires(const _Ip& __i) {
- { std::to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_Ip>>>;
- };
-
-template <class _Ip>
-concept __has_arrow = input_iterator<_Ip> && (is_pointer_v<_Ip> || requires(_Ip __i) { __i.operator->(); });
-
-// [indirectcallable.indirectinvocable]
-template <class _Fp, class _It>
-concept indirectly_unary_invocable =
- indirectly_readable<_It> && copy_constructible<_Fp> && invocable<_Fp&, iter_value_t<_It>&> &&
- invocable<_Fp&, iter_reference_t<_It>> &&
- common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template <class _Fp, class _It>
-concept indirectly_regular_unary_invocable =
- indirectly_readable<_It> && copy_constructible<_Fp> && regular_invocable<_Fp&, iter_value_t<_It>&> &&
- regular_invocable<_Fp&, iter_reference_t<_It>> &&
- common_reference_with< invoke_result_t<_Fp&, iter_value_t<_It>&>, invoke_result_t<_Fp&, iter_reference_t<_It>>>;
-
-template <class _Fp, class _It>
-concept indirect_unary_predicate =
- indirectly_readable<_It> && copy_constructible<_Fp> && predicate<_Fp&, iter_value_t<_It>&> &&
- predicate<_Fp&, iter_reference_t<_It>>;
-
-template <class _Fp, class _It1, class _It2>
-concept indirect_binary_predicate =
- indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- predicate<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>;
-
-template <class _Fp, class _It1, class _It2 = _It1>
-concept indirect_equivalence_relation =
- indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- equivalence_relation<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>;
-
-template <class _Fp, class _It1, class _It2 = _It1>
-concept indirect_strict_weak_order =
- indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fp> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_value_t<_It1>&, iter_reference_t<_It2>> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_value_t<_It2>&> &&
- strict_weak_order<_Fp&, iter_reference_t<_It1>, iter_reference_t<_It2>>;
-
-template <class _Fp, class... _Its>
- requires(indirectly_readable<_Its> && ...) && invocable<_Fp, iter_reference_t<_Its>...>
-using indirect_result_t = invoke_result_t<_Fp, iter_reference_t<_Its>...>;
-
-template <class _In, class _Out>
-concept indirectly_movable = indirectly_readable<_In> && indirectly_writable<_Out, iter_rvalue_reference_t<_In>>;
-
-template <class _In, class _Out>
-concept indirectly_movable_storable =
- indirectly_movable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>> && movable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>;
-
-template <class _In, class _Out>
-concept indirectly_copyable = indirectly_readable<_In> && indirectly_writable<_Out, iter_reference_t<_In>>;
-
-template <class _In, class _Out>
-concept indirectly_copyable_storable =
- indirectly_copyable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&> && indirectly_writable<_Out, iter_value_t<_In>&&> &&
- indirectly_writable<_Out, const iter_value_t<_In>&&> && copyable<iter_value_t<_In>> &&
- constructible_from<iter_value_t<_In>, iter_reference_t<_In>> &&
- assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>;
-
-// Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle
-// (both iter_swap and indirectly_swappable require indirectly_readable).
-
-#endif // _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-using __has_random_access_iterator_category_or_concept
-#if _LIBCPP_STD_VER >= 20
- = integral_constant<bool, random_access_iterator<_Tp>>;
-#else // _LIBCPP_STD_VER < 20
- = __has_random_access_iterator_category<_Tp>;
-#endif // _LIBCPP_STD_VER
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_CONCEPTS_H
diff --git a/libcxx/include/__cxx03/__iterator/counted_iterator.h b/libcxx/include/__cxx03/__iterator/counted_iterator.h
deleted file mode 100644
index 9d6004dc90b84..0000000000000
--- a/libcxx/include/__cxx03/__iterator/counted_iterator.h
+++ /dev/null
@@ -1,289 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_COUNTED_ITERATOR_H
-#define _LIBCPP___CXX03___ITERATOR_COUNTED_ITERATOR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/common_with.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class>
-struct __counted_iterator_concept {};
-
-template <class _Iter>
- requires requires { typename _Iter::iterator_concept; }
-struct __counted_iterator_concept<_Iter> {
- using iterator_concept = typename _Iter::iterator_concept;
-};
-
-template <class>
-struct __counted_iterator_category {};
-
-template <class _Iter>
- requires requires { typename _Iter::iterator_category; }
-struct __counted_iterator_category<_Iter> {
- using iterator_category = typename _Iter::iterator_category;
-};
-
-template <class>
-struct __counted_iterator_value_type {};
-
-template <indirectly_readable _Iter>
-struct __counted_iterator_value_type<_Iter> {
- using value_type = iter_value_t<_Iter>;
-};
-
-template <input_or_output_iterator _Iter>
-class counted_iterator
- : public __counted_iterator_concept<_Iter>,
- public __counted_iterator_category<_Iter>,
- public __counted_iterator_value_type<_Iter> {
-public:
- using iterator_type = _Iter;
- using difference_type = iter_difference_t<_Iter>;
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator()
- requires default_initializable<_Iter>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n)
- : __current_(std::move(__iter)), __count_(__n) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "__n must not be negative.");
- }
-
- template <class _I2>
- requires convertible_to<const _I2&, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(const counted_iterator<_I2>& __other)
- : __current_(__other.__current_), __count_(__other.__count_) {}
-
- template <class _I2>
- requires assignable_from<_Iter&, const _I2&>
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator=(const counted_iterator<_I2>& __other) {
- __current_ = __other.__current_;
- __count_ = __other.__count_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
- return *__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
- requires __dereferenceable<const _Iter>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
- return *__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator->() const noexcept
- requires contiguous_iterator<_Iter>
- {
- return std::to_address(__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator++() {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
- ++__current_;
- --__count_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
- --__count_;
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
- return __current_++;
- } catch (...) {
- ++__count_;
- throw;
- }
-# else
- return __current_++;
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator++(int)
- requires forward_iterator<_Iter>
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
- counted_iterator __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator--()
- requires bidirectional_iterator<_Iter>
- {
- --__current_;
- ++__count_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator--(int)
- requires bidirectional_iterator<_Iter>
- {
- counted_iterator __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
- requires random_access_iterator<_Iter>
- {
- return counted_iterator(__current_ + __n, __count_ - __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator
- operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x)
- requires random_access_iterator<_Iter>
- {
- return __x + __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n)
- requires random_access_iterator<_Iter>
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __count_, "Cannot advance iterator past end.");
- __current_ += __n;
- __count_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
- requires random_access_iterator<_Iter>
- {
- return counted_iterator(__current_ - __n, __count_ + __n);
- }
-
- template <common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
- operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
- return __rhs.__count_ - __lhs.__count_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
- operator-(const counted_iterator& __lhs, default_sentinel_t) {
- return -__lhs.__count_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
- operator-(default_sentinel_t, const counted_iterator& __rhs) {
- return __rhs.__count_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n)
- requires random_access_iterator<_Iter>
- {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- -__n <= __count_,
- "Attempt to subtract too large of a size: "
- "counted_iterator would be decremented before the "
- "first element of its range.");
- __current_ -= __n;
- __count_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
- requires random_access_iterator<_Iter>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size.");
- return __current_[__n];
- }
-
- template <common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
- return __lhs.__count_ == __rhs.__count_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const counted_iterator& __lhs, default_sentinel_t) {
- return __lhs.__count_ == 0;
- }
-
- template <common_with<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
- operator<=>(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
- return __rhs.__count_ <=> __lhs.__count_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
- iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_)))
- requires input_iterator<_Iter>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i.__count_ > 0, "Iterator must not be past end of range.");
- return ranges::iter_move(__i.__current_);
- }
-
- template <indirectly_swappable<_Iter> _I2>
- _LIBCPP_HIDE_FROM_ABI friend constexpr void
- iter_swap(const counted_iterator& __x,
- const counted_iterator<_I2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __x.__count_ > 0 && __y.__count_ > 0, "Iterators must not be past end of range.");
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _Iter __current_ = _Iter();
- iter_difference_t<_Iter> __count_ = 0;
- template <input_or_output_iterator _OtherIter>
- friend class counted_iterator;
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(counted_iterator);
-
-template <input_iterator _Iter>
- requires same_as<_ITER_TRAITS<_Iter>, iterator_traits<_Iter>>
-struct iterator_traits<counted_iterator<_Iter>> : iterator_traits<_Iter> {
- using pointer = conditional_t<contiguous_iterator<_Iter>, add_pointer_t<iter_reference_t<_Iter>>, void>;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_COUNTED_ITERATOR_H
diff --git a/libcxx/include/__cxx03/__iterator/data.h b/libcxx/include/__cxx03/__iterator/data.h
deleted file mode 100644
index 58047e4b6c755..0000000000000
--- a/libcxx/include/__cxx03/__iterator/data.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_DATA_H
-#define _LIBCPP___CXX03___ITERATOR_DATA_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Cont>
-constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
- return __c.data();
-}
-
-template <class _Cont>
-constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
- return __c.data();
-}
-
-template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept {
- return __array;
-}
-
-template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept {
- return __il.begin();
-}
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_DATA_H
diff --git a/libcxx/include/__cxx03/__iterator/default_sentinel.h b/libcxx/include/__cxx03/__iterator/default_sentinel.h
deleted file mode 100644
index 7e1099a3d11c5..0000000000000
--- a/libcxx/include/__cxx03/__iterator/default_sentinel.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_DEFAULT_SENTINEL_H
-#define _LIBCPP___CXX03___ITERATOR_DEFAULT_SENTINEL_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-struct default_sentinel_t {};
-inline constexpr default_sentinel_t default_sentinel{};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_DEFAULT_SENTINEL_H
diff --git a/libcxx/include/__cxx03/__iterator/distance.h b/libcxx/include/__cxx03/__iterator/distance.h
index 91dcc32913799..f6b07228b363e 100644
--- a/libcxx/include/__cxx03/__iterator/distance.h
+++ b/libcxx/include/__cxx03/__iterator/distance.h
@@ -11,12 +11,7 @@
#define _LIBCPP___CXX03___ITERATOR_DISTANCE_H
#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/size.h>
#include <__cxx03/__type_traits/decay.h>
#include <__cxx03/__type_traits/remove_cvref.h>
diff --git a/libcxx/include/__cxx03/__iterator/empty.h b/libcxx/include/__cxx03/__iterator/empty.h
deleted file mode 100644
index 20f505e789c13..0000000000000
--- a/libcxx/include/__cxx03/__iterator/empty.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_EMPTY_H
-#define _LIBCPP___CXX03___ITERATOR_EMPTY_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Cont>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
-empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) {
- return __c.empty();
-}
-
-template <class _Tp, size_t _Sz>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(const _Tp (&)[_Sz]) noexcept {
- return false;
-}
-
-template <class _Ep>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty(initializer_list<_Ep> __il) noexcept {
- return __il.size() == 0;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_EMPTY_H
diff --git a/libcxx/include/__cxx03/__iterator/incrementable_traits.h b/libcxx/include/__cxx03/__iterator/incrementable_traits.h
deleted file mode 100644
index e861f80ecb4d6..0000000000000
--- a/libcxx/include/__cxx03/__iterator/incrementable_traits.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_INCREMENTABLE_TRAITS_H
-#define _LIBCPP___CXX03___ITERATOR_INCREMENTABLE_TRAITS_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_primary_template.h>
-#include <__cxx03/__type_traits/make_signed.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [incrementable.traits]
-template <class>
-struct incrementable_traits {};
-
-template <class _Tp>
- requires is_object_v<_Tp>
-struct incrementable_traits<_Tp*> {
- using difference_type = ptrdiff_t;
-};
-
-template <class _Ip>
-struct incrementable_traits<const _Ip> : incrementable_traits<_Ip> {};
-
-template <class _Tp>
-concept __has_member_difference_type = requires { typename _Tp::difference_type; };
-
-template <__has_member_difference_type _Tp>
-struct incrementable_traits<_Tp> {
- using difference_type = typename _Tp::difference_type;
-};
-
-template <class _Tp>
-concept __has_integral_minus = requires(const _Tp& __x, const _Tp& __y) {
- { __x - __y } -> integral;
-};
-
-template <__has_integral_minus _Tp>
- requires(!__has_member_difference_type<_Tp>)
-struct incrementable_traits<_Tp> {
- using difference_type = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>;
-};
-
-template <class>
-struct iterator_traits;
-
-// Let `RI` be `remove_cvref_t<I>`. The type `iter_difference_t<I>` denotes
-// `incrementable_traits<RI>::difference_type` if `iterator_traits<RI>` names a specialization
-// generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
-template <class _Ip>
-using iter_difference_t =
- typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
- incrementable_traits<remove_cvref_t<_Ip> >,
- iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_INCREMENTABLE_TRAITS_H
diff --git a/libcxx/include/__cxx03/__iterator/indirectly_comparable.h b/libcxx/include/__cxx03/__iterator/indirectly_comparable.h
deleted file mode 100644
index 56de2de09eccd..0000000000000
--- a/libcxx/include/__cxx03/__iterator/indirectly_comparable.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_INDIRECTLY_COMPARABLE_H
-#define _LIBCPP___CXX03___ITERATOR_INDIRECTLY_COMPARABLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.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 _I1, class _I2, class _Rp, class _P1 = identity, class _P2 = identity>
-concept indirectly_comparable = indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_INDIRECTLY_COMPARABLE_H
diff --git a/libcxx/include/__cxx03/__iterator/insert_iterator.h b/libcxx/include/__cxx03/__iterator/insert_iterator.h
index ef063ab73fced..ca08efb0d6b97 100644
--- a/libcxx/include/__cxx03/__iterator/insert_iterator.h
+++ b/libcxx/include/__cxx03/__iterator/insert_iterator.h
@@ -14,7 +14,6 @@
#include <__cxx03/__iterator/iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/cstddef>
diff --git a/libcxx/include/__cxx03/__iterator/istream_iterator.h b/libcxx/include/__cxx03/__iterator/istream_iterator.h
index 71ca4ebc4a384..bf45a1534e11d 100644
--- a/libcxx/include/__cxx03/__iterator/istream_iterator.h
+++ b/libcxx/include/__cxx03/__iterator/istream_iterator.h
@@ -13,7 +13,6 @@
#include <__cxx03/__config>
#include <__cxx03/__fwd/istream.h>
#include <__cxx03/__fwd/string.h>
-#include <__cxx03/__iterator/default_sentinel.h>
#include <__cxx03/__iterator/iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
diff --git a/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h b/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h
index 768747d490cc0..6ef2f4b529c00 100644
--- a/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h
+++ b/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h
@@ -13,7 +13,6 @@
#include <__cxx03/__config>
#include <__cxx03/__fwd/istream.h>
#include <__cxx03/__fwd/streambuf.h>
-#include <__cxx03/__iterator/default_sentinel.h>
#include <__cxx03/__iterator/iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
diff --git a/libcxx/include/__cxx03/__iterator/iter_move.h b/libcxx/include/__cxx03/__iterator/iter_move.h
deleted file mode 100644
index ad33ea065f003..0000000000000
--- a/libcxx/include/__cxx03/__iterator/iter_move.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_ITER_MOVE_H
-#define _LIBCPP___CXX03___ITERATOR_ITER_MOVE_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [iterator.cust.move]
-
-namespace ranges {
-namespace __iter_move {
-
-void iter_move() = delete;
-
-template <class _Tp>
-concept __unqualified_iter_move = __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- iter_move(std::forward<_Tp>(__t));
-};
-
-template <class _Tp>
-concept __move_deref = !__unqualified_iter_move<_Tp> && requires(_Tp&& __t) {
- *__t;
- requires is_lvalue_reference_v<decltype(*__t)>;
-};
-
-template <class _Tp>
-concept __just_deref = !__unqualified_iter_move<_Tp> && !__move_deref<_Tp> && requires(_Tp&& __t) {
- *__t;
- requires(!is_lvalue_reference_v<decltype(*__t)>);
-};
-
-// [iterator.cust.move]
-
-struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) iter_move ADL calls should only be made through ranges::iter_move
- template <class _Ip>
- requires __unqualified_iter_move<_Ip>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Ip&& __i) const
- noexcept(noexcept(iter_move(std::forward<_Ip>(__i)))) {
- return iter_move(std::forward<_Ip>(__i));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _Ip>
- requires __move_deref<_Ip>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(std::move(*std::forward<_Ip>(__i)))) -> decltype(std::move(*std::forward<_Ip>(__i))) {
- return std::move(*std::forward<_Ip>(__i));
- }
-
- template <class _Ip>
- requires __just_deref<_Ip>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ip&& __i) const
- noexcept(noexcept(*std::forward<_Ip>(__i))) -> decltype(*std::forward<_Ip>(__i)) {
- return *std::forward<_Ip>(__i);
- }
-};
-} // namespace __iter_move
-
-inline namespace __cpo {
-inline constexpr auto iter_move = __iter_move::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-template <__dereferenceable _Tp>
- requires requires(_Tp& __t) {
- { ranges::iter_move(__t) } -> __can_reference;
- }
-using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>()));
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_ITER_MOVE_H
diff --git a/libcxx/include/__cxx03/__iterator/iter_swap.h b/libcxx/include/__cxx03/__iterator/iter_swap.h
deleted file mode 100644
index b61092dee724f..0000000000000
--- a/libcxx/include/__cxx03/__iterator/iter_swap.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_ITER_SWAP_H
-#define _LIBCPP___CXX03___ITERATOR_ITER_SWAP_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__concepts/swappable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [iter.cust.swap]
-
-namespace ranges {
-namespace __iter_swap {
-template <class _I1, class _I2>
-void iter_swap(_I1, _I2) = delete;
-
-template <class _T1, class _T2>
-concept __unqualified_iter_swap =
- (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) && requires(_T1&& __x, _T2&& __y) {
- // NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
- };
-
-template <class _T1, class _T2>
-concept __readable_swappable =
- indirectly_readable<_T1> && indirectly_readable<_T2> &&
- swappable_with<iter_reference_t<_T1>, iter_reference_t<_T2>>;
-
-struct __fn {
- // NOLINTBEGIN(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
- template <class _T1, class _T2>
- requires __unqualified_iter_swap<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y)))) {
- (void)iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
- }
- // NOLINTEND(libcpp-robust-against-adl)
-
- template <class _T1, class _T2>
- requires(!__unqualified_iter_swap<_T1, _T2>) && __readable_swappable<_T1, _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y)))) {
- ranges::swap(*std::forward<_T1>(__x), *std::forward<_T2>(__y));
- }
-
- template <class _T1, class _T2>
- requires(!__unqualified_iter_swap<_T1, _T2> && //
- !__readable_swappable<_T1, _T2>) && //
- indirectly_movable_storable<_T1, _T2> && //
- indirectly_movable_storable<_T2, _T1>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_T1&& __x, _T2&& __y) const
- noexcept(noexcept(iter_value_t<_T2>(ranges::iter_move(__y))) && //
- noexcept(*__y = ranges::iter_move(__x)) && //
- noexcept(*std::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>())) {
- iter_value_t<_T2> __old(ranges::iter_move(__y));
- *__y = ranges::iter_move(__x);
- *std::forward<_T1>(__x) = std::move(__old);
- }
-};
-} // namespace __iter_swap
-
-inline namespace __cpo {
-inline constexpr auto iter_swap = __iter_swap::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-template <class _I1, class _I2 = _I1>
-concept indirectly_swappable =
- indirectly_readable<_I1> && indirectly_readable<_I2> && requires(const _I1 __i1, const _I2 __i2) {
- ranges::iter_swap(__i1, __i1);
- ranges::iter_swap(__i2, __i2);
- ranges::iter_swap(__i1, __i2);
- ranges::iter_swap(__i2, __i1);
- };
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_ITER_SWAP_H
diff --git a/libcxx/include/__cxx03/__iterator/iterator_traits.h b/libcxx/include/__cxx03/__iterator/iterator_traits.h
index 66bab3ddd7e57..7e913a55bd28d 100644
--- a/libcxx/include/__cxx03/__iterator/iterator_traits.h
+++ b/libcxx/include/__cxx03/__iterator/iterator_traits.h
@@ -10,18 +10,8 @@
#ifndef _LIBCPP___CXX03___ITERATOR_ITERATOR_TRAITS_H
#define _LIBCPP___CXX03___ITERATOR_ITERATOR_TRAITS_H
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/totally_ordered.h>
#include <__cxx03/__config>
#include <__cxx03/__fwd/pair.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__type_traits/common_reference.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/disjunction.h>
#include <__cxx03/__type_traits/is_convertible.h>
diff --git a/libcxx/include/__cxx03/__iterator/iterator_with_data.h b/libcxx/include/__cxx03/__iterator/iterator_with_data.h
deleted file mode 100644
index e6aa66922237b..0000000000000
--- a/libcxx/include/__cxx03/__iterator/iterator_with_data.h
+++ /dev/null
@@ -1,105 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ITERATOR_ITERATOR_WITH_DATA_H
-#define _LIBCPP___CXX03___ITERATOR_ITERATOR_WITH_DATA_H
-
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <forward_iterator _Iterator, class _Data>
-class __iterator_with_data {
- _Iterator __iter_{};
- _Data __data_{};
-
-public:
- using value_type = iter_value_t<_Iterator>;
- using difference_type = iter_difference_t<_Iterator>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator_with_data() = default;
-
- constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data(_Iterator __iter, _Data __data)
- : __iter_(std::move(__iter)), __data_(std::move(__data)) {}
-
- constexpr _LIBCPP_HIDE_FROM_ABI _Iterator __get_iter() const { return __iter_; }
-
- constexpr _LIBCPP_HIDE_FROM_ABI _Data __get_data() && { return std::move(__data_); }
-
- friend constexpr _LIBCPP_HIDE_FROM_ABI bool
- operator==(const __iterator_with_data& __lhs, const __iterator_with_data& __rhs) {
- return __lhs.__iter_ == __rhs.__iter_;
- }
-
- constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator++() {
- ++__iter_;
- return *this;
- }
-
- constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator++(int) {
- auto __tmp = *this;
- __iter_++;
- return __tmp;
- }
-
- constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data& operator--()
- requires bidirectional_iterator<_Iterator>
- {
- --__iter_;
- return *this;
- }
-
- constexpr _LIBCPP_HIDE_FROM_ABI __iterator_with_data operator--(int)
- requires bidirectional_iterator<_Iterator>
- {
- auto __tmp = *this;
- --__iter_;
- return __tmp;
- }
-
- constexpr _LIBCPP_HIDE_FROM_ABI iter_reference_t<_Iterator> operator*() const { return *__iter_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iterator>
- iter_move(const __iterator_with_data& __iter) noexcept(noexcept(ranges::iter_move(__iter.__iter_))) {
- return ranges::iter_move(__iter.__iter_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void
- iter_swap(const __iterator_with_data& __lhs,
- const __iterator_with_data& __rhs) noexcept(noexcept(ranges::iter_swap(__lhs.__iter_, __rhs.__iter_)))
- requires indirectly_swappable<_Iterator>
- {
- return ranges::iter_swap(__lhs.__data_, __rhs.__iter_);
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_ITERATOR_WITH_DATA_H
diff --git a/libcxx/include/__cxx03/__iterator/mergeable.h b/libcxx/include/__cxx03/__iterator/mergeable.h
deleted file mode 100644
index 5e54fd28a33ff..0000000000000
--- a/libcxx/include/__cxx03/__iterator/mergeable.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_MERGEABLE_H
-#define _LIBCPP___CXX03___ITERATOR_MERGEABLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/projected.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 _Input1,
- class _Input2,
- class _Output,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
-concept mergeable =
- input_iterator<_Input1> && input_iterator<_Input2> && weakly_incrementable<_Output> &&
- indirectly_copyable<_Input1, _Output> && indirectly_copyable<_Input2, _Output> &&
- indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_MERGEABLE_H
diff --git a/libcxx/include/__cxx03/__iterator/move_iterator.h b/libcxx/include/__cxx03/__iterator/move_iterator.h
index 0fbcfdd0c1d9f..4d84ca2656307 100644
--- a/libcxx/include/__cxx03/__iterator/move_iterator.h
+++ b/libcxx/include/__cxx03/__iterator/move_iterator.h
@@ -10,20 +10,8 @@
#ifndef _LIBCPP___CXX03___ITERATOR_MOVE_ITERATOR_H
#define _LIBCPP___CXX03___ITERATOR_MOVE_ITERATOR_H
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/same_as.h>
#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/move_sentinel.h>
-#include <__cxx03/__iterator/readable_traits.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/enable_if.h>
#include <__cxx03/__type_traits/is_assignable.h>
diff --git a/libcxx/include/__cxx03/__iterator/move_sentinel.h b/libcxx/include/__cxx03/__iterator/move_sentinel.h
deleted file mode 100644
index cb4cf95a8c6ec..0000000000000
--- a/libcxx/include/__cxx03/__iterator/move_sentinel.h
+++ /dev/null
@@ -1,61 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___ITERATOR_MOVE_SENTINEL_H
-#define _LIBCPP___CXX03___ITERATOR_MOVE_SENTINEL_H
-
-#include <__cxx03/__concepts/assignable.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <semiregular _Sent>
-class _LIBCPP_TEMPLATE_VIS move_sentinel {
-public:
- _LIBCPP_HIDE_FROM_ABI move_sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
-
- template <class _S2>
- requires convertible_to<const _S2&, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
-
- template <class _S2>
- requires assignable_from<_Sent&, const _S2&>
- _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s) {
- __last_ = __s.base();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
-
-private:
- _Sent __last_ = _Sent();
-};
-
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___ITERATOR_MOVE_SENTINEL_H
diff --git a/libcxx/include/__cxx03/__iterator/next.h b/libcxx/include/__cxx03/__iterator/next.h
index 459702fd43743..2b4f03e94dd3c 100644
--- a/libcxx/include/__cxx03/__iterator/next.h
+++ b/libcxx/include/__cxx03/__iterator/next.h
@@ -13,8 +13,6 @@
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/enable_if.h>
diff --git a/libcxx/include/__cxx03/__iterator/permutable.h b/libcxx/include/__cxx03/__iterator/permutable.h
deleted file mode 100644
index 368c4089f1316..0000000000000
--- a/libcxx/include/__cxx03/__iterator/permutable.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_PERMUTABLE_H
-#define _LIBCPP___CXX03___ITERATOR_PERMUTABLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_swap.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 _Iterator>
-concept permutable =
- forward_iterator<_Iterator> && indirectly_movable_storable<_Iterator, _Iterator> &&
- indirectly_swappable<_Iterator, _Iterator>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_PERMUTABLE_H
diff --git a/libcxx/include/__cxx03/__iterator/prev.h b/libcxx/include/__cxx03/__iterator/prev.h
index c272e52a9349b..2921971b88a30 100644
--- a/libcxx/include/__cxx03/__iterator/prev.h
+++ b/libcxx/include/__cxx03/__iterator/prev.h
@@ -13,8 +13,6 @@
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/enable_if.h>
diff --git a/libcxx/include/__cxx03/__iterator/projected.h b/libcxx/include/__cxx03/__iterator/projected.h
deleted file mode 100644
index b80b7d56da890..0000000000000
--- a/libcxx/include/__cxx03/__iterator/projected.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_PROJECTED_H
-#define _LIBCPP___CXX03___ITERATOR_PROJECTED_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h> // iter_difference_t
-#include <__cxx03/__type_traits/remove_cvref.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 _It, class _Proj>
-struct __projected_impl {
- struct __type {
- using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
- indirect_result_t<_Proj&, _It> operator*() const; // not defined
- };
-};
-
-template <weakly_incrementable _It, class _Proj>
-struct __projected_impl<_It, _Proj> {
- struct __type {
- using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>;
- using difference_type = iter_difference_t<_It>;
- indirect_result_t<_Proj&, _It> operator*() const; // not defined
- };
-};
-
-// Note that we implement std::projected in a way that satisfies P2538R1 even in standard
-// modes before C++26 to avoid breaking the ABI between standard modes (even though ABI
-// breaks with std::projected are expected to have essentially no impact).
-template <indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj>
-using projected = typename __projected_impl<_It, _Proj>::__type;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_PROJECTED_H
diff --git a/libcxx/include/__cxx03/__iterator/ranges_iterator_traits.h b/libcxx/include/__cxx03/__iterator/ranges_iterator_traits.h
deleted file mode 100644
index b2333ace6d631..0000000000000
--- a/libcxx/include/__cxx03/__iterator/ranges_iterator_traits.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_RANGES_ITERATOR_TRAITS_H
-#define _LIBCPP___CXX03___ITERATOR_RANGES_ITERATOR_TRAITS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/pair.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/remove_const.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <ranges::input_range _Range>
-using __range_key_type = __remove_const_t<typename ranges::range_value_t<_Range>::first_type>;
-
-template <ranges::input_range _Range>
-using __range_mapped_type = typename ranges::range_value_t<_Range>::second_type;
-
-template <ranges::input_range _Range>
-using __range_to_alloc_type =
- pair<const typename ranges::range_value_t<_Range>::first_type, typename ranges::range_value_t<_Range>::second_type>;
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_RANGES_ITERATOR_TRAITS_H
diff --git a/libcxx/include/__cxx03/__iterator/readable_traits.h b/libcxx/include/__cxx03/__iterator/readable_traits.h
deleted file mode 100644
index c7b21649d8a18..0000000000000
--- a/libcxx/include/__cxx03/__iterator/readable_traits.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_READABLE_TRAITS_H
-#define _LIBCPP___CXX03___ITERATOR_READABLE_TRAITS_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_primary_template.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_extent.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [readable.traits]
-template <class>
-struct __cond_value_type {};
-
-template <class _Tp>
- requires is_object_v<_Tp>
-struct __cond_value_type<_Tp> {
- using value_type = remove_cv_t<_Tp>;
-};
-
-template <class _Tp>
-concept __has_member_value_type = requires { typename _Tp::value_type; };
-
-template <class _Tp>
-concept __has_member_element_type = requires { typename _Tp::element_type; };
-
-template <class>
-struct indirectly_readable_traits {};
-
-template <class _Ip>
- requires is_array_v<_Ip>
-struct indirectly_readable_traits<_Ip> {
- using value_type = remove_cv_t<remove_extent_t<_Ip>>;
-};
-
-template <class _Ip>
-struct indirectly_readable_traits<const _Ip> : indirectly_readable_traits<_Ip> {};
-
-template <class _Tp>
-struct indirectly_readable_traits<_Tp*> : __cond_value_type<_Tp> {};
-
-template <__has_member_value_type _Tp>
-struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
-
-template <__has_member_element_type _Tp>
-struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {};
-
-template <__has_member_value_type _Tp>
- requires __has_member_element_type<_Tp>
-struct indirectly_readable_traits<_Tp> {};
-
-template <__has_member_value_type _Tp>
- requires __has_member_element_type<_Tp> &&
- same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>>
-struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_READABLE_TRAITS_H
diff --git a/libcxx/include/__cxx03/__iterator/reverse_access.h b/libcxx/include/__cxx03/__iterator/reverse_access.h
deleted file mode 100644
index bea5b1412c1f9..0000000000000
--- a/libcxx/include/__cxx03/__iterator/reverse_access.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_REVERSE_ACCESS_H
-#define _LIBCPP___CXX03___ITERATOR_REVERSE_ACCESS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/initializer_list>
-
-#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, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {
- return reverse_iterator<_Tp*>(__array + _Np);
-}
-
-template <class _Tp, size_t _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {
- return reverse_iterator<_Tp*>(__array);
-}
-
-template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) {
- return reverse_iterator<const _Ep*>(__il.end());
-}
-
-template <class _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) {
- return reverse_iterator<const _Ep*>(__il.begin());
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {
- return __c.rbegin();
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) {
- return __c.rbegin();
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {
- return __c.rend();
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) {
- return __c.rend();
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) {
- return std::rbegin(__c);
-}
-
-template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) {
- return std::rend(__c);
-}
-
-#endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_REVERSE_ACCESS_H
diff --git a/libcxx/include/__cxx03/__iterator/reverse_iterator.h b/libcxx/include/__cxx03/__iterator/reverse_iterator.h
index b95ca27ff5fb0..9c4d7a8a9b2ed 100644
--- a/libcxx/include/__cxx03/__iterator/reverse_iterator.h
+++ b/libcxx/include/__cxx03/__iterator/reverse_iterator.h
@@ -11,25 +11,14 @@
#define _LIBCPP___CXX03___ITERATOR_REVERSE_ITERATOR_H
#include <__cxx03/__algorithm/unwrap_iter.h>
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/convertible_to.h>
#include <__cxx03/__config>
#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
#include <__cxx03/__iterator/iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
#include <__cxx03/__iterator/prev.h>
-#include <__cxx03/__iterator/readable_traits.h>
#include <__cxx03/__iterator/segmented_iterator.h>
#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/subrange.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/enable_if.h>
#include <__cxx03/__type_traits/is_assignable.h>
diff --git a/libcxx/include/__cxx03/__iterator/size.h b/libcxx/include/__cxx03/__iterator/size.h
deleted file mode 100644
index b0374a6c59e1c..0000000000000
--- a/libcxx/include/__cxx03/__iterator/size.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_SIZE_H
-#define _LIBCPP___CXX03___ITERATOR_SIZE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/make_signed.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) noexcept(noexcept(__c.size())) -> decltype(__c.size()) {
- return __c.size();
-}
-
-template <class _Tp, size_t _Sz>
-_LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
- return _Sz;
-}
-
-# if _LIBCPP_STD_VER >= 20
-template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(
- __c.size()))) -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
- return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size());
-}
-
-// GCC complains about the implicit conversion from ptrdiff_t to size_t in
-// the array bound.
-_LIBCPP_DIAGNOSTIC_PUSH
-_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion")
-template <class _Tp, ptrdiff_t _Sz>
-_LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept {
- return _Sz;
-}
-_LIBCPP_DIAGNOSTIC_POP
-# endif
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_SIZE_H
diff --git a/libcxx/include/__cxx03/__iterator/sortable.h b/libcxx/include/__cxx03/__iterator/sortable.h
deleted file mode 100644
index ae82f0f615432..0000000000000
--- a/libcxx/include/__cxx03/__iterator/sortable.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_SORTABLE_H
-#define _LIBCPP___CXX03___ITERATOR_SORTABLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/permutable.h>
-#include <__cxx03/__iterator/projected.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 _Iter, class _Comp = ranges::less, class _Proj = identity>
-concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_SORTABLE_H
diff --git a/libcxx/include/__cxx03/__iterator/unreachable_sentinel.h b/libcxx/include/__cxx03/__iterator/unreachable_sentinel.h
deleted file mode 100644
index 6184692b4074a..0000000000000
--- a/libcxx/include/__cxx03/__iterator/unreachable_sentinel.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___ITERATOR_UNREACHABLE_SENTINEL_H
-#define _LIBCPP___CXX03___ITERATOR_UNREACHABLE_SENTINEL_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-struct unreachable_sentinel_t {
- template <weakly_incrementable _Iter>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(unreachable_sentinel_t, const _Iter&) noexcept {
- return false;
- }
-};
-
-inline constexpr unreachable_sentinel_t unreachable_sentinel{};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___ITERATOR_UNREACHABLE_SENTINEL_H
diff --git a/libcxx/include/__cxx03/__iterator/wrap_iter.h b/libcxx/include/__cxx03/__iterator/wrap_iter.h
index 8e7df13490974..a184372050c11 100644
--- a/libcxx/include/__cxx03/__iterator/wrap_iter.h
+++ b/libcxx/include/__cxx03/__iterator/wrap_iter.h
@@ -10,8 +10,6 @@
#ifndef _LIBCPP___CXX03___ITERATOR_WRAP_ITER_H
#define _LIBCPP___CXX03___ITERATOR_WRAP_ITER_H
-#include <__cxx03/__compare/ordering.h>
-#include <__cxx03/__compare/three_way_comparable.h>
#include <__cxx03/__config>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
diff --git a/libcxx/include/__cxx03/__math/special_functions.h b/libcxx/include/__cxx03/__math/special_functions.h
deleted file mode 100644
index 38832215b89d5..0000000000000
--- a/libcxx/include/__cxx03/__math/special_functions.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___MATH_SPECIAL_FUNCTIONS_H
-#define _LIBCPP___CXX03___MATH_SPECIAL_FUNCTIONS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__math/copysign.h>
-#include <__cxx03/__math/traits.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Real>
-_LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) {
- // The Hermite polynomial H_n(x).
- // The implementation is based on the recurrence formula: H_{n+1}(x) = 2x H_n(x) - 2n H_{n-1}.
- // Press, William H., et al. Numerical recipes 3rd edition: The art of scientific computing.
- // Cambridge university press, 2007, p. 183.
-
- // NOLINTBEGIN(readability-identifier-naming)
- if (__math::isnan(__x))
- return __x;
-
- _Real __H_0{1};
- if (__n == 0)
- return __H_0;
-
- _Real __H_n_prev = __H_0;
- _Real __H_n = 2 * __x;
- for (unsigned __i = 1; __i < __n; ++__i) {
- _Real __H_n_next = 2 * (__x * __H_n - __i * __H_n_prev);
- __H_n_prev = __H_n;
- __H_n = __H_n_next;
- }
-
- if (!__math::isfinite(__H_n)) {
- // Overflow occured. Two possible cases:
- // n is odd: return infinity of the same sign as x.
- // n is even: return +Inf
- _Real __inf = std::numeric_limits<_Real>::infinity();
- return (__n & 1) ? __math::copysign(__inf, __x) : __inf;
- }
- return __H_n;
- // NOLINTEND(readability-identifier-naming)
-}
-
-inline _LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, double __x) { return std::__hermite(__n, __x); }
-
-inline _LIBCPP_HIDE_FROM_ABI float hermite(unsigned __n, float __x) {
- // use double internally -- float is too prone to overflow!
- return static_cast<float>(std::hermite(__n, static_cast<double>(__x)));
-}
-
-inline _LIBCPP_HIDE_FROM_ABI long double hermite(unsigned __n, long double __x) { return std::__hermite(__n, __x); }
-
-inline _LIBCPP_HIDE_FROM_ABI float hermitef(unsigned __n, float __x) { return std::hermite(__n, __x); }
-
-inline _LIBCPP_HIDE_FROM_ABI long double hermitel(unsigned __n, long double __x) { return std::hermite(__n, __x); }
-
-template <class _Integer, std::enable_if_t<std::is_integral_v<_Integer>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, _Integer __x) {
- return std::hermite(__n, static_cast<double>(__x));
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___MATH_SPECIAL_FUNCTIONS_H
diff --git a/libcxx/include/__cxx03/__mdspan/default_accessor.h b/libcxx/include/__cxx03/__mdspan/default_accessor.h
deleted file mode 100644
index 1f7c331818566..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/default_accessor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H
-#define _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_abstract.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/cinttypes>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _ElementType>
-struct default_accessor {
- static_assert(!is_array_v<_ElementType>, "default_accessor: template argument may not be an array type");
- static_assert(!is_abstract_v<_ElementType>, "default_accessor: template argument may not be an abstract class");
-
- using offset_policy = default_accessor;
- using element_type = _ElementType;
- using reference = _ElementType&;
- using data_handle_type = _ElementType*;
-
- _LIBCPP_HIDE_FROM_ABI constexpr default_accessor() noexcept = default;
- template <class _OtherElementType>
- requires(is_convertible_v<_OtherElementType (*)[], element_type (*)[]>)
- _LIBCPP_HIDE_FROM_ABI constexpr default_accessor(default_accessor<_OtherElementType>) noexcept {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference access(data_handle_type __p, size_t __i) const noexcept { return __p[__i]; }
- _LIBCPP_HIDE_FROM_ABI constexpr data_handle_type offset(data_handle_type __p, size_t __i) const noexcept {
- return __p + __i;
- }
-};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H
diff --git a/libcxx/include/__cxx03/__mdspan/extents.h b/libcxx/include/__cxx03/__mdspan/extents.h
deleted file mode 100644
index d6fc8b8af75aa..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/extents.h
+++ /dev/null
@@ -1,532 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_EXTENTS_H
-#define _LIBCPP___CXX03___MDSPAN_EXTENTS_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/array>
-#include <__cxx03/cinttypes>
-#include <__cxx03/concepts>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-#include <__cxx03/span>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace __mdspan_detail {
-
-// ------------------------------------------------------------------
-// ------------ __static_array --------------------------------------
-// ------------------------------------------------------------------
-// array like class which provides an array of static values with get
-template <class _Tp, _Tp... _Values>
-struct __static_array {
- static constexpr array<_Tp, sizeof...(_Values)> __array = {_Values...};
-
-public:
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Values); }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get(size_t __index) noexcept { return __array[__index]; }
-
- template <size_t _Index>
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get() {
- return __get(_Index);
- }
-};
-
-// ------------------------------------------------------------------
-// ------------ __possibly_empty_array -----------------------------
-// ------------------------------------------------------------------
-
-// array like class which provides get function and operator [], and
-// has a specialization for the size 0 case.
-// This is needed to make the __maybe_static_array be truly empty, for
-// all static values.
-
-template <class _Tp, size_t _Size>
-struct __possibly_empty_array {
- _Tp __vals_[_Size];
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator[](size_t __index) { return __vals_[__index]; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __index) const { return __vals_[__index]; }
-};
-
-template <class _Tp>
-struct __possibly_empty_array<_Tp, 0> {
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator[](size_t) { __libcpp_unreachable(); }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t) const { __libcpp_unreachable(); }
-};
-
-// ------------------------------------------------------------------
-// ------------ static_partial_sums ---------------------------------
-// ------------------------------------------------------------------
-
-// Provides a compile time partial sum one can index into
-
-template <size_t... _Values>
-struct __static_partial_sums {
- _LIBCPP_HIDE_FROM_ABI static constexpr array<size_t, sizeof...(_Values)> __static_partial_sums_impl() {
- array<size_t, sizeof...(_Values)> __values{_Values...};
- array<size_t, sizeof...(_Values)> __partial_sums{{}};
- size_t __running_sum = 0;
- for (int __i = 0; __i != sizeof...(_Values); ++__i) {
- __partial_sums[__i] = __running_sum;
- __running_sum += __values[__i];
- }
- return __partial_sums;
- }
- static constexpr array<size_t, sizeof...(_Values)> __result{__static_partial_sums_impl()};
-
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t __get(size_t __index) { return __result[__index]; }
-};
-
-// ------------------------------------------------------------------
-// ------------ __maybe_static_array --------------------------------
-// ------------------------------------------------------------------
-
-// array like class which has a mix of static and runtime values but
-// only stores the runtime values.
-// The type of the static and the runtime values can be different.
-// The position of a dynamic value is indicated through a tag value.
-template <class _TDynamic, class _TStatic, _TStatic _DynTag, _TStatic... _Values>
-struct __maybe_static_array {
- static_assert(is_convertible<_TStatic, _TDynamic>::value,
- "__maybe_static_array: _TStatic must be convertible to _TDynamic");
- static_assert(is_convertible<_TDynamic, _TStatic>::value,
- "__maybe_static_array: _TDynamic must be convertible to _TStatic");
-
-private:
- // Static values member
- static constexpr size_t __size_ = sizeof...(_Values);
- static constexpr size_t __size_dynamic_ = ((_Values == _DynTag) + ... + 0);
- using _StaticValues = __static_array<_TStatic, _Values...>;
- using _DynamicValues = __possibly_empty_array<_TDynamic, __size_dynamic_>;
-
- // Dynamic values member
- _LIBCPP_NO_UNIQUE_ADDRESS _DynamicValues __dyn_vals_;
-
- // static mapping of indices to the position in the dynamic values array
- using _DynamicIdxMap = __static_partial_sums<static_cast<size_t>(_Values == _DynTag)...>;
-
- template <size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI static constexpr _DynamicValues __zeros(index_sequence<_Indices...>) noexcept {
- return _DynamicValues{((void)_Indices, 0)...};
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array() noexcept
- : __dyn_vals_{__zeros(make_index_sequence<__size_dynamic_>())} {}
-
- // constructors from dynamic values only -- this covers the case for rank() == 0
- template <class... _DynVals>
- requires(sizeof...(_DynVals) == __size_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(_DynVals... __vals)
- : __dyn_vals_{static_cast<_TDynamic>(__vals)...} {}
-
- template <class _Tp, size_t _Size >
- requires(_Size == __size_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array([[maybe_unused]] const span<_Tp, _Size>& __vals) {
- if constexpr (_Size > 0) {
- for (size_t __i = 0; __i < _Size; __i++)
- __dyn_vals_[__i] = static_cast<_TDynamic>(__vals[__i]);
- }
- }
-
- // constructors from all values -- here rank will be greater than 0
- template <class... _DynVals>
- requires(sizeof...(_DynVals) != __size_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(_DynVals... __vals) {
- static_assert(sizeof...(_DynVals) == __size_, "Invalid number of values.");
- _TDynamic __values[__size_] = {static_cast<_TDynamic>(__vals)...};
- for (size_t __i = 0; __i < __size_; __i++) {
- _TStatic __static_val = _StaticValues::__get(__i);
- if (__static_val == _DynTag) {
- __dyn_vals_[_DynamicIdxMap::__get(__i)] = __values[__i];
- } else
- // Not catching this could lead to out of bounds errors later
- // e.g. using my_mdspan_t = mdspan<int, extents<int, 10>>; my_mdspan_t = m(new int[5], 5);
- // Right-hand-side construction looks ok with allocation and size matching,
- // but since (potentially elsewhere defined) my_mdspan_t has static size m now thinks its range is 10 not 5
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __values[__i] == static_cast<_TDynamic>(__static_val),
- "extents construction: mismatch of provided arguments with static extents.");
- }
- }
-
- template <class _Tp, size_t _Size>
- requires(_Size != __size_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(const span<_Tp, _Size>& __vals) {
- static_assert(_Size == __size_ || __size_ == dynamic_extent);
- for (size_t __i = 0; __i < __size_; __i++) {
- _TStatic __static_val = _StaticValues::__get(__i);
- if (__static_val == _DynTag) {
- __dyn_vals_[_DynamicIdxMap::__get(__i)] = static_cast<_TDynamic>(__vals[__i]);
- } else
- // Not catching this could lead to out of bounds errors later
- // e.g. using my_mdspan_t = mdspan<int, extents<int, 10>>; my_mdspan_t = m(new int[N], span<int,1>(&N));
- // Right-hand-side construction looks ok with allocation and size matching,
- // but since (potentially elsewhere defined) my_mdspan_t has static size m now thinks its range is 10 not N
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- static_cast<_TDynamic>(__vals[__i]) == static_cast<_TDynamic>(__static_val),
- "extents construction: mismatch of provided arguments with static extents.");
- }
- }
-
- // access functions
- _LIBCPP_HIDE_FROM_ABI static constexpr _TStatic __static_value(size_t __i) noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
- return _StaticValues::__get(__i);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic __value(size_t __i) const {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
- _TStatic __static_val = _StaticValues::__get(__i);
- return __static_val == _DynTag ? __dyn_vals_[_DynamicIdxMap::__get(__i)] : static_cast<_TDynamic>(__static_val);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic operator[](size_t __i) const {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
- return __value(__i);
- }
-
- // observers
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return __size_; }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size_dynamic() { return __size_dynamic_; }
-};
-
-// Function to check whether a value is representable as another type
-// value must be a positive integer otherwise returns false
-// if _From is not an integral, we just check positivity
-template <integral _To, class _From>
- requires(integral<_From>)
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_representable_as(_From __value) {
- using _To_u = make_unsigned_t<_To>;
- using _From_u = make_unsigned_t<_From>;
- if constexpr (is_signed_v<_From>) {
- if (__value < 0)
- return false;
- }
- if constexpr (static_cast<_To_u>(numeric_limits<_To>::max()) >= static_cast<_From_u>(numeric_limits<_From>::max())) {
- return true;
- } else {
- return static_cast<_To_u>(numeric_limits<_To>::max()) >= static_cast<_From_u>(__value);
- }
-}
-
-template <integral _To, class _From>
- requires(!integral<_From>)
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_representable_as(_From __value) {
- if constexpr (is_signed_v<_To>) {
- if (static_cast<_To>(__value) < 0)
- return false;
- }
- return true;
-}
-
-template <integral _To, class... _From>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(_From... __values) {
- return (__mdspan_detail::__is_representable_as<_To>(__values) && ... && true);
-}
-
-template <integral _To, class _From, size_t _Size>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(span<_From, _Size> __values) {
- for (size_t __i = 0; __i < _Size; __i++)
- if (!__mdspan_detail::__is_representable_as<_To>(__values[__i]))
- return false;
- return true;
-}
-
-} // namespace __mdspan_detail
-
-// ------------------------------------------------------------------
-// ------------ extents ---------------------------------------------
-// ------------------------------------------------------------------
-
-// Class to describe the extents of a multi dimensional array.
-// Used by mdspan, mdarray and layout mappings.
-// See ISO C++ standard [mdspan.extents]
-
-template <class _IndexType, size_t... _Extents>
-class extents {
-public:
- // typedefs for integral types used
- using index_type = _IndexType;
- using size_type = make_unsigned_t<index_type>;
- using rank_type = size_t;
-
- static_assert(is_integral<index_type>::value && !is_same<index_type, bool>::value,
- "extents::index_type must be a signed or unsigned integer type");
- static_assert(((__mdspan_detail::__is_representable_as<index_type>(_Extents) || (_Extents == dynamic_extent)) && ...),
- "extents ctor: arguments must be representable as index_type and nonnegative");
-
-private:
- static constexpr rank_type __rank_ = sizeof...(_Extents);
- static constexpr rank_type __rank_dynamic_ = ((_Extents == dynamic_extent) + ... + 0);
-
- // internal storage type using __maybe_static_array
- using _Values = __mdspan_detail::__maybe_static_array<_IndexType, size_t, dynamic_extent, _Extents...>;
- [[no_unique_address]] _Values __vals_;
-
-public:
- // [mdspan.extents.obs], observers of multidimensional index space
- _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; }
- _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { return __rank_dynamic_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept { return __vals_.__value(__r); }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
- return _Values::__static_value(__r);
- }
-
- // [mdspan.extents.cons], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr extents() noexcept = default;
-
- // Construction from just dynamic or all values.
- // Precondition check is deferred to __maybe_static_array constructor
- template <class... _OtherIndexTypes>
- requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
- (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_))
- _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept
- : __vals_(static_cast<index_type>(__dynvals)...) {
- // Not catching this could lead to out of bounds errors later
- // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__dynvals...),
- "extents ctor: arguments must be representable as index_type and nonnegative");
- }
-
- template <class _OtherIndexType, size_t _Size>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&> &&
- (_Size == __rank_ || _Size == __rank_dynamic_))
- explicit(_Size != __rank_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept
- : __vals_(span(__exts)) {
- // Not catching this could lead to out of bounds errors later
- // e.g. mdspan m(ptr, dextents<char, 1>(array<unsigned,1>(200))); leads to an extent of -56 on m
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(span(__exts)),
- "extents ctor: arguments must be representable as index_type and nonnegative");
- }
-
- template <class _OtherIndexType, size_t _Size>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&> &&
- (_Size == __rank_ || _Size == __rank_dynamic_))
- explicit(_Size != __rank_dynamic_)
- _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept
- : __vals_(__exts) {
- // Not catching this could lead to out of bounds errors later
- // e.g. array a{200u}; mdspan<int, dextents<char,1>> m(ptr, extents(span<unsigned,1>(a))); leads to an extent of -56
- // on m
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__exts),
- "extents ctor: arguments must be representable as index_type and nonnegative");
- }
-
-private:
- // Function to construct extents storage from other extents.
- template <size_t _DynCount, size_t _Idx, class _OtherExtents, class... _DynamicValues>
- requires(_Idx < __rank_)
- _LIBCPP_HIDE_FROM_ABI constexpr _Values __construct_vals_from_extents(
- integral_constant<size_t, _DynCount>,
- integral_constant<size_t, _Idx>,
- const _OtherExtents& __exts,
- _DynamicValues... __dynamic_values) noexcept {
- if constexpr (static_extent(_Idx) == dynamic_extent)
- return __construct_vals_from_extents(
- integral_constant<size_t, _DynCount + 1>(),
- integral_constant<size_t, _Idx + 1>(),
- __exts,
- __dynamic_values...,
- __exts.extent(_Idx));
- else
- return __construct_vals_from_extents(
- integral_constant<size_t, _DynCount>(), integral_constant<size_t, _Idx + 1>(), __exts, __dynamic_values...);
- }
-
- template <size_t _DynCount, size_t _Idx, class _OtherExtents, class... _DynamicValues>
- requires((_Idx == __rank_) && (_DynCount == __rank_dynamic_))
- _LIBCPP_HIDE_FROM_ABI constexpr _Values __construct_vals_from_extents(
- integral_constant<size_t, _DynCount>,
- integral_constant<size_t, _Idx>,
- const _OtherExtents&,
- _DynamicValues... __dynamic_values) noexcept {
- return _Values{static_cast<index_type>(__dynamic_values)...};
- }
-
-public:
- // Converting constructor from other extents specializations
- template <class _OtherIndexType, size_t... _OtherExtents>
- requires((sizeof...(_OtherExtents) == sizeof...(_Extents)) &&
- ((_OtherExtents == dynamic_extent || _Extents == dynamic_extent || _OtherExtents == _Extents) && ...))
- explicit((((_Extents != dynamic_extent) && (_OtherExtents == dynamic_extent)) || ...) ||
- (static_cast<make_unsigned_t<index_type>>(numeric_limits<index_type>::max()) <
- static_cast<make_unsigned_t<_OtherIndexType>>(numeric_limits<_OtherIndexType>::max())))
- _LIBCPP_HIDE_FROM_ABI constexpr extents(const extents<_OtherIndexType, _OtherExtents...>& __other) noexcept
- : __vals_(
- __construct_vals_from_extents(integral_constant<size_t, 0>(), integral_constant<size_t, 0>(), __other)) {
- if constexpr (rank() > 0) {
- for (size_t __r = 0; __r < rank(); __r++) {
- if constexpr (static_cast<make_unsigned_t<index_type>>(numeric_limits<index_type>::max()) <
- static_cast<make_unsigned_t<_OtherIndexType>>(numeric_limits<_OtherIndexType>::max())) {
- // Not catching this could lead to out of bounds errors later
- // e.g. dextents<char,1>> e(dextents<unsigned,1>(200)) leads to an extent of -56 on e
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.extent(__r)),
- "extents ctor: arguments must be representable as index_type and nonnegative");
- }
- // Not catching this could lead to out of bounds errors later
- // e.g. mdspan<int, extents<int, 10>> m = mdspan<int, dextents<int, 1>>(new int[5], 5);
- // Right-hand-side construction was ok, but m now thinks its range is 10 not 5
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- (_Values::__static_value(__r) == dynamic_extent) ||
- (static_cast<index_type>(__other.extent(__r)) == static_cast<index_type>(_Values::__static_value(__r))),
- "extents construction: mismatch of provided arguments with static extents.");
- }
- }
- }
-
- // Comparison operator
- template <class _OtherIndexType, size_t... _OtherExtents>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const extents& __lhs, const extents<_OtherIndexType, _OtherExtents...>& __rhs) noexcept {
- if constexpr (rank() != sizeof...(_OtherExtents)) {
- return false;
- } else {
- for (rank_type __r = 0; __r < __rank_; __r++) {
- // avoid warning when comparing signed and unsigner integers and pick the wider of two types
- using _CommonType = common_type_t<index_type, _OtherIndexType>;
- if (static_cast<_CommonType>(__lhs.extent(__r)) != static_cast<_CommonType>(__rhs.extent(__r))) {
- return false;
- }
- }
- }
- return true;
- }
-};
-
-// Recursive helper classes to implement dextents alias for extents
-namespace __mdspan_detail {
-
-template <class _IndexType, size_t _Rank, class _Extents = extents<_IndexType>>
-struct __make_dextents;
-
-template <class _IndexType, size_t _Rank, size_t... _ExtentsPack>
-struct __make_dextents< _IndexType, _Rank, extents<_IndexType, _ExtentsPack...>> {
- using type =
- typename __make_dextents< _IndexType, _Rank - 1, extents<_IndexType, dynamic_extent, _ExtentsPack...>>::type;
-};
-
-template <class _IndexType, size_t... _ExtentsPack>
-struct __make_dextents< _IndexType, 0, extents<_IndexType, _ExtentsPack...>> {
- using type = extents<_IndexType, _ExtentsPack...>;
-};
-
-} // end namespace __mdspan_detail
-
-// [mdspan.extents.dextents], alias template
-template <class _IndexType, size_t _Rank>
-using dextents = typename __mdspan_detail::__make_dextents<_IndexType, _Rank>::type;
-
-# if _LIBCPP_STD_VER >= 26
-// [mdspan.extents.dims], alias template `dims`
-template <size_t _Rank, class _IndexType = size_t>
-using dims = dextents<_IndexType, _Rank>;
-# endif
-
-// Deduction guide for extents
-# if _LIBCPP_STD_VER >= 26
-template <class... _IndexTypes>
- requires(is_convertible_v<_IndexTypes, size_t> && ...)
-explicit extents(_IndexTypes...) -> extents<size_t, __maybe_static_ext<_IndexTypes>...>;
-# else
-template <class... _IndexTypes>
- requires(is_convertible_v<_IndexTypes, size_t> && ...)
-explicit extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;
-# endif
-
-namespace __mdspan_detail {
-
-// Helper type traits for identifying a class as extents.
-template <class _Tp>
-struct __is_extents : false_type {};
-
-template <class _IndexType, size_t... _ExtentsPack>
-struct __is_extents<extents<_IndexType, _ExtentsPack...>> : true_type {};
-
-template <class _Tp>
-inline constexpr bool __is_extents_v = __is_extents<_Tp>::value;
-
-// Function to check whether a set of indices are a multidimensional
-// index into extents. This is a word of power in the C++ standard
-// requiring that the indices are larger than 0 and smaller than
-// the respective extents.
-
-template <integral _IndexType, class _From>
- requires(integral<_From>)
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_index_in_extent(_IndexType __extent, _From __value) {
- if constexpr (is_signed_v<_From>) {
- if (__value < 0)
- return false;
- }
- using _Tp = common_type_t<_IndexType, _From>;
- return static_cast<_Tp>(__value) < static_cast<_Tp>(__extent);
-}
-
-template <integral _IndexType, class _From>
- requires(!integral<_From>)
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_index_in_extent(_IndexType __extent, _From __value) {
- if constexpr (is_signed_v<_IndexType>) {
- if (static_cast<_IndexType>(__value) < 0)
- return false;
- }
- return static_cast<_IndexType>(__value) < __extent;
-}
-
-template <size_t... _Idxs, class _Extents, class... _From>
-_LIBCPP_HIDE_FROM_ABI constexpr bool
-__is_multidimensional_index_in_impl(index_sequence<_Idxs...>, const _Extents& __ext, _From... __values) {
- return (__mdspan_detail::__is_index_in_extent(__ext.extent(_Idxs), __values) && ...);
-}
-
-template <class _Extents, class... _From>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __is_multidimensional_index_in(const _Extents& __ext, _From... __values) {
- return __mdspan_detail::__is_multidimensional_index_in_impl(
- make_index_sequence<_Extents::rank()>(), __ext, __values...);
-}
-
-} // namespace __mdspan_detail
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_EXTENTS_H
diff --git a/libcxx/include/__cxx03/__mdspan/layout_left.h b/libcxx/include/__cxx03/__mdspan/layout_left.h
deleted file mode 100644
index 7f667238818b3..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/layout_left.h
+++ /dev/null
@@ -1,204 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_LAYOUT_LEFT_H
-#define _LIBCPP___CXX03___MDSPAN_LAYOUT_LEFT_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/mdspan.h>
-#include <__cxx03/__mdspan/extents.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/array>
-#include <__cxx03/cinttypes>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Extents>
-class layout_left::mapping {
-public:
- static_assert(__mdspan_detail::__is_extents<_Extents>::value,
- "layout_left::mapping template argument must be a specialization of extents.");
-
- using extents_type = _Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_left;
-
-private:
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __required_span_size_is_representable(const extents_type& __ext) {
- if constexpr (extents_type::rank() == 0)
- return true;
-
- index_type __prod = __ext.extent(0);
- for (rank_type __r = 1; __r < extents_type::rank(); __r++) {
- bool __overflowed = __builtin_mul_overflow(__prod, __ext.extent(__r), &__prod);
- if (__overflowed)
- return false;
- }
- return true;
- }
-
- static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
- "layout_left::mapping product of static extents must be representable as index_type.");
-
-public:
- // [mdspan.layout.left.cons], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr mapping() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const mapping&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext) noexcept : __extents_(__ext) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // mapping<dextents<char, 2>> map(dextents<char, 2>(40,40)); map(10, 3) == -126
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __required_span_size_is_representable(__ext),
- "layout_left::mapping extents ctor: product of extents must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
- mapping(const mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // mapping<dextents<char, 2>> map(mapping<dextents<int, 2>>(dextents<int, 2>(40,40))); map(10, 3) == -126
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_left::mapping converting ctor: other.required_span_size() must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents> && _OtherExtents::rank() <= 1)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
- mapping(const layout_right::mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // Note: since this is constraint to rank 1, extents itself would catch the invalid conversion first
- // and thus this assertion should never be triggered, but keeping it here for consistency
- // layout_left::mapping<dextents<char, 1>> map(
- // layout_right::mapping<dextents<unsigned, 1>>(dextents<unsigned, 1>(200))); map.extents().extent(0) ==
- // -56
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_left::mapping converting ctor: other.required_span_size() must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(extents_type::rank() > 0)
- mapping(const layout_stride::mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- if constexpr (extents_type::rank() > 0) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ([&]() {
- using _CommonType = common_type_t<typename extents_type::index_type, typename _OtherExtents::index_type>;
- for (rank_type __r = 0; __r < extents_type::rank(); __r++)
- if (static_cast<_CommonType>(stride(__r)) != static_cast<_CommonType>(__other.stride(__r)))
- return false;
- return true;
- }()),
- "layout_left::mapping from layout_stride ctor: strides are not compatible with layout_left.");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_left::mapping from layout_stride ctor: other.required_span_size() must be representable as "
- "index_type.");
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.left.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept { return __extents_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type required_span_size() const noexcept {
- index_type __size = 1;
- for (size_t __r = 0; __r < extents_type::rank(); __r++)
- __size *= __extents_.extent(__r);
- return __size;
- }
-
- template <class... _Indices>
- requires((sizeof...(_Indices) == extents_type::rank()) && (is_convertible_v<_Indices, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _Indices> && ...))
- _LIBCPP_HIDE_FROM_ABI constexpr index_type operator()(_Indices... __idx) const noexcept {
- // Mappings are generally meant to be used for accessing allocations and are meant to guarantee to never
- // return a value exceeding required_span_size(), which is used to know how large an allocation one needs
- // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks
- // However, mdspan does check this on its own, so for now we avoid double checking in hardened mode
- _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...),
- "layout_left::mapping: out of bounds indexing");
- array<index_type, extents_type::rank()> __idx_a{static_cast<index_type>(__idx)...};
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- index_type __res = 0;
- ((__res = __idx_a[extents_type::rank() - 1 - _Pos] + __extents_.extent(extents_type::rank() - 1 - _Pos) * __res),
- ...);
- return __res;
- }(make_index_sequence<sizeof...(_Indices)>());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_exhaustive() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const noexcept
- requires(extents_type::rank() > 0)
- {
- // While it would be caught by extents itself too, using a too large __r
- // is functionally an out of bounds access on the stored information needed to compute strides
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __r < extents_type::rank(), "layout_left::mapping::stride(): invalid rank index");
- index_type __s = 1;
- for (rank_type __i = 0; __i < __r; __i++)
- __s *= __extents_.extent(__i);
- return __s;
- }
-
- template <class _OtherExtents>
- requires(_OtherExtents::rank() == extents_type::rank())
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const mapping& __lhs, const mapping<_OtherExtents>& __rhs) noexcept {
- return __lhs.extents() == __rhs.extents();
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS extents_type __extents_{};
-};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_LAYOUT_LEFT_H
diff --git a/libcxx/include/__cxx03/__mdspan/layout_right.h b/libcxx/include/__cxx03/__mdspan/layout_right.h
deleted file mode 100644
index 12dc5a1b558d8..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/layout_right.h
+++ /dev/null
@@ -1,201 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_LAYOUT_RIGHT_H
-#define _LIBCPP___CXX03___MDSPAN_LAYOUT_RIGHT_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/mdspan.h>
-#include <__cxx03/__mdspan/extents.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/cinttypes>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Extents>
-class layout_right::mapping {
-public:
- static_assert(__mdspan_detail::__is_extents<_Extents>::value,
- "layout_right::mapping template argument must be a specialization of extents.");
-
- using extents_type = _Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_right;
-
-private:
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __required_span_size_is_representable(const extents_type& __ext) {
- if constexpr (extents_type::rank() == 0)
- return true;
-
- index_type __prod = __ext.extent(0);
- for (rank_type __r = 1; __r < extents_type::rank(); __r++) {
- bool __overflowed = __builtin_mul_overflow(__prod, __ext.extent(__r), &__prod);
- if (__overflowed)
- return false;
- }
- return true;
- }
-
- static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
- "layout_right::mapping product of static extents must be representable as index_type.");
-
-public:
- // [mdspan.layout.right.cons], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr mapping() noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const mapping&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext) noexcept : __extents_(__ext) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // mapping<dextents<char, 2>> map(dextents<char, 2>(40,40)); map(3, 10) == -126
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __required_span_size_is_representable(__ext),
- "layout_right::mapping extents ctor: product of extents must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
- mapping(const mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // mapping<dextents<char, 2>> map(mapping<dextents<int, 2>>(dextents<int, 2>(40,40))); map(3, 10) == -126
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_right::mapping converting ctor: other.required_span_size() must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents> && _OtherExtents::rank() <= 1)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
- mapping(const layout_left::mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- // not catching this could lead to out-of-bounds access later when used inside mdspan
- // Note: since this is constraint to rank 1, extents itself would catch the invalid conversion first
- // and thus this assertion should never be triggered, but keeping it here for consistency
- // layout_right::mapping<dextents<char, 1>> map(
- // layout_left::mapping<dextents<unsigned, 1>>(dextents<unsigned, 1>(200))); map.extents().extent(0) ==
- // -56
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_right::mapping converting ctor: other.required_span_size() must be representable as index_type.");
- }
-
- template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(extents_type::rank() > 0)
- mapping(const layout_stride::mapping<_OtherExtents>& __other) noexcept
- : __extents_(__other.extents()) {
- if constexpr (extents_type::rank() > 0) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ([&]() {
- using _CommonType = common_type_t<typename extents_type::index_type, typename _OtherExtents::index_type>;
- for (rank_type __r = 0; __r < extents_type::rank(); __r++)
- if (static_cast<_CommonType>(stride(__r)) != static_cast<_CommonType>(__other.stride(__r)))
- return false;
- return true;
- }()),
- "layout_right::mapping from layout_stride ctor: strides are not compatible with layout_right.");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_right::mapping from layout_stride ctor: other.required_span_size() must be representable as "
- "index_type.");
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.right.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept { return __extents_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type required_span_size() const noexcept {
- index_type __size = 1;
- for (size_t __r = 0; __r < extents_type::rank(); __r++)
- __size *= __extents_.extent(__r);
- return __size;
- }
-
- template <class... _Indices>
- requires((sizeof...(_Indices) == extents_type::rank()) && (is_convertible_v<_Indices, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _Indices> && ...))
- _LIBCPP_HIDE_FROM_ABI constexpr index_type operator()(_Indices... __idx) const noexcept {
- // Mappings are generally meant to be used for accessing allocations and are meant to guarantee to never
- // return a value exceeding required_span_size(), which is used to know how large an allocation one needs
- // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks
- // However, mdspan does check this on its own, so for now we avoid double checking in hardened mode
- _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...),
- "layout_right::mapping: out of bounds indexing");
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- index_type __res = 0;
- ((__res = static_cast<index_type>(__idx) + __extents_.extent(_Pos) * __res), ...);
- return __res;
- }(make_index_sequence<sizeof...(_Indices)>());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_exhaustive() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const noexcept
- requires(extents_type::rank() > 0)
- {
- // While it would be caught by extents itself too, using a too large __r
- // is functionally an out of bounds access on the stored information needed to compute strides
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __r < extents_type::rank(), "layout_right::mapping::stride(): invalid rank index");
- index_type __s = 1;
- for (rank_type __i = extents_type::rank() - 1; __i > __r; __i--)
- __s *= __extents_.extent(__i);
- return __s;
- }
-
- template <class _OtherExtents>
- requires(_OtherExtents::rank() == extents_type::rank())
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const mapping& __lhs, const mapping<_OtherExtents>& __rhs) noexcept {
- return __lhs.extents() == __rhs.extents();
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS extents_type __extents_{};
-};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_LAYOUT_RIGHT_H
diff --git a/libcxx/include/__cxx03/__mdspan/layout_stride.h b/libcxx/include/__cxx03/__mdspan/layout_stride.h
deleted file mode 100644
index d97ce1a55610e..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/layout_stride.h
+++ /dev/null
@@ -1,366 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_LAYOUT_STRIDE_H
-#define _LIBCPP___CXX03___MDSPAN_LAYOUT_STRIDE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/mdspan.h>
-#include <__cxx03/__mdspan/extents.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/as_const.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/array>
-#include <__cxx03/cinttypes>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace __mdspan_detail {
-template <class _Layout, class _Mapping>
-constexpr bool __is_mapping_of =
- is_same_v<typename _Layout::template mapping<typename _Mapping::extents_type>, _Mapping>;
-
-template <class _Mapping>
-concept __layout_mapping_alike = requires {
- requires __is_mapping_of<typename _Mapping::layout_type, _Mapping>;
- requires __is_extents_v<typename _Mapping::extents_type>;
- { _Mapping::is_always_strided() } -> same_as<bool>;
- { _Mapping::is_always_exhaustive() } -> same_as<bool>;
- { _Mapping::is_always_unique() } -> same_as<bool>;
- bool_constant<_Mapping::is_always_strided()>::value;
- bool_constant<_Mapping::is_always_exhaustive()>::value;
- bool_constant<_Mapping::is_always_unique()>::value;
-};
-} // namespace __mdspan_detail
-
-template <class _Extents>
-class layout_stride::mapping {
-public:
- static_assert(__mdspan_detail::__is_extents<_Extents>::value,
- "layout_stride::mapping template argument must be a specialization of extents.");
-
- using extents_type = _Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_stride;
-
-private:
- static constexpr rank_type __rank_ = extents_type::rank();
-
- // Used for default construction check and mandates
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __required_span_size_is_representable(const extents_type& __ext) {
- if constexpr (__rank_ == 0)
- return true;
-
- index_type __prod = __ext.extent(0);
- for (rank_type __r = 1; __r < __rank_; __r++) {
- bool __overflowed = __builtin_mul_overflow(__prod, __ext.extent(__r), &__prod);
- if (__overflowed)
- return false;
- }
- return true;
- }
-
- template <class _OtherIndexType>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool
- __required_span_size_is_representable(const extents_type& __ext, span<_OtherIndexType, __rank_> __strides) {
- if constexpr (__rank_ == 0)
- return true;
-
- index_type __size = 1;
- for (rank_type __r = 0; __r < __rank_; __r++) {
- // We can only check correct conversion of _OtherIndexType if it is an integral
- if constexpr (is_integral_v<_OtherIndexType>) {
- using _CommonType = common_type_t<index_type, _OtherIndexType>;
- if (static_cast<_CommonType>(__strides[__r]) > static_cast<_CommonType>(numeric_limits<index_type>::max()))
- return false;
- }
- if (__ext.extent(__r) == static_cast<index_type>(0))
- return true;
- index_type __prod = (__ext.extent(__r) - 1);
- bool __overflowed_mul = __builtin_mul_overflow(__prod, static_cast<index_type>(__strides[__r]), &__prod);
- if (__overflowed_mul)
- return false;
- bool __overflowed_add = __builtin_add_overflow(__size, __prod, &__size);
- if (__overflowed_add)
- return false;
- }
- return true;
- }
-
- // compute offset of a strided layout mapping
- template <class _StridedMapping>
- _LIBCPP_HIDE_FROM_ABI static constexpr index_type __offset(const _StridedMapping& __mapping) {
- if constexpr (_StridedMapping::extents_type::rank() == 0) {
- return static_cast<index_type>(__mapping());
- } else if (__mapping.required_span_size() == static_cast<typename _StridedMapping::index_type>(0)) {
- return static_cast<index_type>(0);
- } else {
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return static_cast<index_type>(__mapping((_Pos ? 0 : 0)...));
- }(make_index_sequence<__rank_>());
- }
- }
-
- // compute the permutation for sorting the stride array
- // we never actually sort the stride array
- _LIBCPP_HIDE_FROM_ABI constexpr void __bubble_sort_by_strides(array<rank_type, __rank_>& __permute) const {
- for (rank_type __i = __rank_ - 1; __i > 0; __i--) {
- for (rank_type __r = 0; __r < __i; __r++) {
- if (__strides_[__permute[__r]] > __strides_[__permute[__r + 1]]) {
- swap(__permute[__r], __permute[__r + 1]);
- } else {
- // if two strides are the same then one of the associated extents must be 1 or 0
- // both could be, but you can't have one larger than 1 come first
- if ((__strides_[__permute[__r]] == __strides_[__permute[__r + 1]]) &&
- (__extents_.extent(__permute[__r]) > static_cast<index_type>(1)))
- swap(__permute[__r], __permute[__r + 1]);
- }
- }
- }
- }
-
- static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
- "layout_stride::mapping product of static extents must be representable as index_type.");
-
-public:
- // [mdspan.layout.stride.cons], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr mapping() noexcept : __extents_(extents_type()) {
- // Note the nominal precondition is covered by above static assert since
- // if rank_dynamic is != 0 required_span_size is zero for default construction
- if constexpr (__rank_ > 0) {
- index_type __stride = 1;
- for (rank_type __r = __rank_ - 1; __r > static_cast<rank_type>(0); __r--) {
- __strides_[__r] = __stride;
- __stride *= __extents_.extent(__r);
- }
- __strides_[0] = __stride;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const mapping&) noexcept = default;
-
- template <class _OtherIndexType>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext, span<_OtherIndexType, __rank_> __strides) noexcept
- : __extents_(__ext), __strides_([&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return __mdspan_detail::__possibly_empty_array<index_type, __rank_>{
- static_cast<index_type>(std::as_const(__strides[_Pos]))...};
- }(make_index_sequence<__rank_>())) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ([&]<size_t... _Pos>(index_sequence<_Pos...>) {
- // For integrals we can do a pre-conversion check, for other types not
- if constexpr (is_integral_v<_OtherIndexType>) {
- return ((__strides[_Pos] > static_cast<_OtherIndexType>(0)) && ... && true);
- } else {
- return ((static_cast<index_type>(__strides[_Pos]) > static_cast<index_type>(0)) && ... && true);
- }
- }(make_index_sequence<__rank_>())),
- "layout_stride::mapping ctor: all strides must be greater than 0");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __required_span_size_is_representable(__ext, __strides),
- "layout_stride::mapping ctor: required span size is not representable as index_type.");
- if constexpr (__rank_ > 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- ([&]<size_t... _Pos>(index_sequence<_Pos...>) {
- // basically sort the dimensions based on strides and extents, sorting is represented in permute array
- array<rank_type, __rank_> __permute{_Pos...};
- __bubble_sort_by_strides(__permute);
-
- // check that this permutations represents a growing set
- for (rank_type __i = 1; __i < __rank_; __i++)
- if (static_cast<index_type>(__strides[__permute[__i]]) <
- static_cast<index_type>(__strides[__permute[__i - 1]]) * __extents_.extent(__permute[__i - 1]))
- return false;
- return true;
- }(make_index_sequence<__rank_>())),
- "layout_stride::mapping ctor: the provided extents and strides lead to a non-unique mapping");
- }
- }
-
- template <class _OtherIndexType>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
- _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext,
- const array<_OtherIndexType, __rank_>& __strides) noexcept
- : mapping(__ext, span(__strides)) {}
-
- template <class _StridedLayoutMapping>
- requires(__mdspan_detail::__layout_mapping_alike<_StridedLayoutMapping> &&
- is_constructible_v<extents_type, typename _StridedLayoutMapping::extents_type> &&
- _StridedLayoutMapping::is_always_unique() && _StridedLayoutMapping::is_always_strided())
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(
- !(is_convertible_v<typename _StridedLayoutMapping::extents_type, extents_type> &&
- (__mdspan_detail::__is_mapping_of<layout_left, _StridedLayoutMapping> ||
- __mdspan_detail::__is_mapping_of<layout_right, _StridedLayoutMapping> ||
- __mdspan_detail::__is_mapping_of<layout_stride, _StridedLayoutMapping>)))
- mapping(const _StridedLayoutMapping& __other) noexcept
- : __extents_(__other.extents()), __strides_([&]<size_t... _Pos>(index_sequence<_Pos...>) {
- // stride() only compiles for rank > 0
- if constexpr (__rank_ > 0) {
- return __mdspan_detail::__possibly_empty_array<index_type, __rank_>{
- static_cast<index_type>(__other.stride(_Pos))...};
- } else {
- return __mdspan_detail::__possibly_empty_array<index_type, 0>{};
- }
- }(make_index_sequence<__rank_>())) {
- // stride() only compiles for rank > 0
- if constexpr (__rank_ > 0) {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- ([&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return ((static_cast<index_type>(__other.stride(_Pos)) > static_cast<index_type>(0)) && ... && true);
- }(make_index_sequence<__rank_>())),
- "layout_stride::mapping converting ctor: all strides must be greater than 0");
- }
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __mdspan_detail::__is_representable_as<index_type>(__other.required_span_size()),
- "layout_stride::mapping converting ctor: other.required_span_size() must be representable as index_type.");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(static_cast<index_type>(0) == __offset(__other),
- "layout_stride::mapping converting ctor: base offset of mapping must be zero.");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.stride.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept { return __extents_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr array<index_type, __rank_> strides() const noexcept {
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return array<index_type, __rank_>{__strides_[_Pos]...};
- }(make_index_sequence<__rank_>());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr index_type required_span_size() const noexcept {
- if constexpr (__rank_ == 0) {
- return static_cast<index_type>(1);
- } else {
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- if ((__extents_.extent(_Pos) * ... * 1) == 0)
- return static_cast<index_type>(0);
- else
- return static_cast<index_type>(
- static_cast<index_type>(1) +
- (((__extents_.extent(_Pos) - static_cast<index_type>(1)) * __strides_[_Pos]) + ... +
- static_cast<index_type>(0)));
- }(make_index_sequence<__rank_>());
- }
- }
-
- template <class... _Indices>
- requires((sizeof...(_Indices) == __rank_) && (is_convertible_v<_Indices, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _Indices> && ...))
- _LIBCPP_HIDE_FROM_ABI constexpr index_type operator()(_Indices... __idx) const noexcept {
- // Mappings are generally meant to be used for accessing allocations and are meant to guarantee to never
- // return a value exceeding required_span_size(), which is used to know how large an allocation one needs
- // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks
- // However, mdspan does check this on its own, so for now we avoid double checking in hardened mode
- _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...),
- "layout_stride::mapping: out of bounds indexing");
- return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return ((static_cast<index_type>(__idx) * __strides_[_Pos]) + ... + index_type(0));
- }(make_index_sequence<sizeof...(_Indices)>());
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { return false; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; }
- // The answer of this function is fairly complex in the case where one or more
- // extents are zero.
- // Technically it is meaningless to query is_exhaustive() in that case, but unfortunately
- // the way the standard defines this function, we can't give a simple true or false then.
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const noexcept {
- if constexpr (__rank_ == 0)
- return true;
- else {
- index_type __span_size = required_span_size();
- if (__span_size == static_cast<index_type>(0)) {
- if constexpr (__rank_ == 1)
- return __strides_[0] == 1;
- else {
- rank_type __r_largest = 0;
- for (rank_type __r = 1; __r < __rank_; __r++)
- if (__strides_[__r] > __strides_[__r_largest])
- __r_largest = __r;
- for (rank_type __r = 0; __r < __rank_; __r++)
- if (__extents_.extent(__r) == 0 && __r != __r_largest)
- return false;
- return true;
- }
- } else {
- return required_span_size() == [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- return (__extents_.extent(_Pos) * ... * static_cast<index_type>(1));
- }(make_index_sequence<__rank_>());
- }
- }
- }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; }
-
- // according to the standard layout_stride does not have a constraint on stride(r) for rank>0
- // it still has the precondition though
- _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__r < __rank_, "layout_stride::mapping::stride(): invalid rank index");
- return __strides_[__r];
- }
-
- template <class _OtherMapping>
- requires(__mdspan_detail::__layout_mapping_alike<_OtherMapping> &&
- (_OtherMapping::extents_type::rank() == __rank_) && _OtherMapping::is_always_strided())
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const mapping& __lhs, const _OtherMapping& __rhs) noexcept {
- if (__offset(__rhs))
- return false;
- if constexpr (__rank_ == 0)
- return true;
- else {
- return __lhs.extents() == __rhs.extents() && [&]<size_t... _Pos>(index_sequence<_Pos...>) {
- // avoid warning when comparing signed and unsigner integers and pick the wider of two types
- using _CommonType = common_type_t<index_type, typename _OtherMapping::index_type>;
- return ((static_cast<_CommonType>(__lhs.stride(_Pos)) == static_cast<_CommonType>(__rhs.stride(_Pos))) && ... &&
- true);
- }(make_index_sequence<__rank_>());
- }
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS extents_type __extents_{};
- _LIBCPP_NO_UNIQUE_ADDRESS __mdspan_detail::__possibly_empty_array<index_type, __rank_> __strides_{};
-};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_LAYOUT_STRIDE_H
diff --git a/libcxx/include/__cxx03/__mdspan/mdspan.h b/libcxx/include/__cxx03/__mdspan/mdspan.h
deleted file mode 100644
index a1f6f00d61b71..0000000000000
--- a/libcxx/include/__cxx03/__mdspan/mdspan.h
+++ /dev/null
@@ -1,319 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-// Kokkos v. 4.0
-// Copyright (2022) National Technology & Engineering
-// Solutions of Sandia, LLC (NTESS).
-//
-// Under the terms of Contract DE-NA0003525 with NTESS,
-// the U.S. Government retains certain rights in this software.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MDSPAN_MDSPAN_H
-#define _LIBCPP___CXX03___MDSPAN_MDSPAN_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/mdspan.h>
-#include <__cxx03/__mdspan/default_accessor.h>
-#include <__cxx03/__mdspan/extents.h>
-#include <__cxx03/__type_traits/extent.h>
-#include <__cxx03/__type_traits/is_abstract.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/rank.h>
-#include <__cxx03/__type_traits/remove_all_extents.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/array>
-#include <__cxx03/cinttypes>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-#include <__cxx03/span>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-// Helper for lightweight test checking that one did pass a layout policy as LayoutPolicy template argument
-namespace __mdspan_detail {
-template <class _Layout, class _Extents>
-concept __has_invalid_mapping = !requires { typename _Layout::template mapping<_Extents>; };
-} // namespace __mdspan_detail
-
-template <class _ElementType,
- class _Extents,
- class _LayoutPolicy = layout_right,
- class _AccessorPolicy = default_accessor<_ElementType> >
-class mdspan {
-private:
- static_assert(__mdspan_detail::__is_extents_v<_Extents>,
- "mdspan: Extents template parameter must be a specialization of extents.");
- static_assert(!is_array_v<_ElementType>, "mdspan: ElementType template parameter may not be an array type");
- static_assert(!is_abstract_v<_ElementType>, "mdspan: ElementType template parameter may not be an abstract class");
- static_assert(is_same_v<_ElementType, typename _AccessorPolicy::element_type>,
- "mdspan: ElementType template parameter must match AccessorPolicy::element_type");
- static_assert(!__mdspan_detail::__has_invalid_mapping<_LayoutPolicy, _Extents>,
- "mdspan: LayoutPolicy template parameter is invalid. A common mistake is to pass a layout mapping "
- "instead of a layout policy");
-
-public:
- using extents_type = _Extents;
- using layout_type = _LayoutPolicy;
- using accessor_type = _AccessorPolicy;
- using mapping_type = typename layout_type::template mapping<extents_type>;
- using element_type = _ElementType;
- using value_type = remove_cv_t<element_type>;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using data_handle_type = typename accessor_type::data_handle_type;
- using reference = typename accessor_type::reference;
-
- _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); }
- _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t static_extent(rank_type __r) noexcept {
- return extents_type::static_extent(__r);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept {
- return __map_.extents().extent(__r);
- };
-
-public:
- //--------------------------------------------------------------------------------
- // [mdspan.mdspan.cons], mdspan constructors, assignment, and destructor
-
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan()
- requires((extents_type::rank_dynamic() > 0) && is_default_constructible_v<data_handle_type> &&
- is_default_constructible_v<mapping_type> && is_default_constructible_v<accessor_type>)
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(const mdspan&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(mdspan&&) = default;
-
- template <class... _OtherIndexTypes>
- requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
- ((sizeof...(_OtherIndexTypes) == rank()) || (sizeof...(_OtherIndexTypes) == rank_dynamic())) &&
- is_constructible_v<mapping_type, extents_type> && is_default_constructible_v<accessor_type>)
- _LIBCPP_HIDE_FROM_ABI explicit constexpr mdspan(data_handle_type __p, _OtherIndexTypes... __exts)
- : __ptr_(std::move(__p)), __map_(extents_type(static_cast<index_type>(std::move(__exts))...)), __acc_{} {}
-
- template <class _OtherIndexType, size_t _Size>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&> &&
- ((_Size == rank()) || (_Size == rank_dynamic())) && is_constructible_v<mapping_type, extents_type> &&
- is_default_constructible_v<accessor_type>)
- explicit(_Size != rank_dynamic())
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(data_handle_type __p, const array<_OtherIndexType, _Size>& __exts)
- : __ptr_(std::move(__p)), __map_(extents_type(__exts)), __acc_{} {}
-
- template <class _OtherIndexType, size_t _Size>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&> &&
- ((_Size == rank()) || (_Size == rank_dynamic())) && is_constructible_v<mapping_type, extents_type> &&
- is_default_constructible_v<accessor_type>)
- explicit(_Size != rank_dynamic())
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(data_handle_type __p, span<_OtherIndexType, _Size> __exts)
- : __ptr_(std::move(__p)), __map_(extents_type(__exts)), __acc_{} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(data_handle_type __p, const extents_type& __exts)
- requires(is_default_constructible_v<accessor_type> && is_constructible_v<mapping_type, const extents_type&>)
- : __ptr_(std::move(__p)), __map_(__exts), __acc_{} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(data_handle_type __p, const mapping_type& __m)
- requires(is_default_constructible_v<accessor_type>)
- : __ptr_(std::move(__p)), __map_(__m), __acc_{} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(data_handle_type __p, const mapping_type& __m, const accessor_type& __a)
- : __ptr_(std::move(__p)), __map_(__m), __acc_(__a) {}
-
- template <class _OtherElementType, class _OtherExtents, class _OtherLayoutPolicy, class _OtherAccessor>
- requires(is_constructible_v<mapping_type, const typename _OtherLayoutPolicy::template mapping<_OtherExtents>&> &&
- is_constructible_v<accessor_type, const _OtherAccessor&>)
- explicit(!is_convertible_v<const typename _OtherLayoutPolicy::template mapping<_OtherExtents>&, mapping_type> ||
- !is_convertible_v<const _OtherAccessor&, accessor_type>)
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan(
- const mdspan<_OtherElementType, _OtherExtents, _OtherLayoutPolicy, _OtherAccessor>& __other)
- : __ptr_(__other.__ptr_), __map_(__other.__map_), __acc_(__other.__acc_) {
- static_assert(is_constructible_v<data_handle_type, const typename _OtherAccessor::data_handle_type&>,
- "mdspan: incompatible data_handle_type for mdspan construction");
- static_assert(
- is_constructible_v<extents_type, _OtherExtents>, "mdspan: incompatible extents for mdspan construction");
-
- // The following precondition is part of the standard, but is unlikely to be triggered.
- // The extents constructor checks this and the mapping must be storing the extents, since
- // its extents() function returns a const reference to extents_type.
- // The only way this can be triggered is if the mapping conversion constructor would for example
- // always construct its extents() only from the dynamic extents, instead of from the other extents.
- if constexpr (rank() > 0) {
- for (size_t __r = 0; __r < rank(); __r++) {
- // Not catching this could lead to out of bounds errors later
- // e.g. mdspan<int, dextents<char,1>, non_checking_layout> m =
- // mdspan<int, dextents<unsigned, 1>, non_checking_layout>(ptr, 200); leads to an extent of -56 on m
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- (static_extent(__r) == dynamic_extent) ||
- (static_cast<index_type>(__other.extent(__r)) == static_cast<index_type>(static_extent(__r))),
- "mdspan: conversion mismatch of source dynamic extents with static extents");
- }
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan& operator=(const mdspan&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr mdspan& operator=(mdspan&&) = default;
-
- //--------------------------------------------------------------------------------
- // [mdspan.mdspan.members], members
-
- template <class... _OtherIndexTypes>
- requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) &&
- (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
- (sizeof...(_OtherIndexTypes) == rank()))
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const {
- // Note the standard layouts would also check this, but user provided ones may not, so we
- // check the precondition here
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...),
- "mdspan: operator[] out of bounds access");
- return __acc_.access(__ptr_, __map_(static_cast<index_type>(std::move(__indices))...));
- }
-
- template <class _OtherIndexType>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](const array< _OtherIndexType, rank()>& __indices) const {
- return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
- return __map_(__indices[_Idxs]...);
- }(make_index_sequence<rank()>()));
- }
-
- template <class _OtherIndexType>
- requires(is_convertible_v<const _OtherIndexType&, index_type> &&
- is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const {
- return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
- return __map_(__indices[_Idxs]...);
- }(make_index_sequence<rank()>()));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept {
- // Could leave this as only checked in debug mode: semantically size() is never
- // guaranteed to be related to any accessible range
- _LIBCPP_ASSERT_UNCATEGORIZED(
- false == ([&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
- size_type __prod = 1;
- return (__builtin_mul_overflow(__prod, extent(_Idxs), &__prod) || ... || false);
- }(make_index_sequence<rank()>())),
- "mdspan: size() is not representable as size_type");
- return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
- return ((static_cast<size_type>(__map_.extents().extent(_Idxs))) * ... * size_type(1));
- }(make_index_sequence<rank()>());
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept {
- return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
- return (rank() > 0) && ((__map_.extents().extent(_Idxs) == index_type(0)) || ... || false);
- }(make_index_sequence<rank()>());
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void swap(mdspan& __x, mdspan& __y) noexcept {
- swap(__x.__ptr_, __y.__ptr_);
- swap(__x.__map_, __y.__map_);
- swap(__x.__acc_, __y.__acc_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept { return __map_.extents(); };
- _LIBCPP_HIDE_FROM_ABI constexpr const data_handle_type& data_handle() const noexcept { return __ptr_; };
- _LIBCPP_HIDE_FROM_ABI constexpr const mapping_type& mapping() const noexcept { return __map_; };
- _LIBCPP_HIDE_FROM_ABI constexpr const accessor_type& accessor() const noexcept { return __acc_; };
-
- // per LWG-4021 "mdspan::is_always_meow() should be noexcept"
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); };
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept {
- return mapping_type::is_always_exhaustive();
- };
- _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept {
- return mapping_type::is_always_strided();
- };
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_unique() const { return __map_.is_unique(); };
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const { return __map_.is_exhaustive(); };
- _LIBCPP_HIDE_FROM_ABI constexpr bool is_strided() const { return __map_.is_strided(); };
- _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const { return __map_.stride(__r); };
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS data_handle_type __ptr_{};
- _LIBCPP_NO_UNIQUE_ADDRESS mapping_type __map_{};
- _LIBCPP_NO_UNIQUE_ADDRESS accessor_type __acc_{};
-
- template <class, class, class, class>
- friend class mdspan;
-};
-
-# if _LIBCPP_STD_VER >= 26
-template <class _ElementType, class... _OtherIndexTypes>
- requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0))
-explicit mdspan(_ElementType*,
- _OtherIndexTypes...) -> mdspan<_ElementType, extents<size_t, __maybe_static_ext<_OtherIndexTypes>...>>;
-# else
-template <class _ElementType, class... _OtherIndexTypes>
- requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0))
-explicit mdspan(_ElementType*,
- _OtherIndexTypes...) -> mdspan<_ElementType, dextents<size_t, sizeof...(_OtherIndexTypes)>>;
-# endif
-
-template <class _Pointer>
- requires(is_pointer_v<remove_reference_t<_Pointer>>)
-mdspan(_Pointer&&) -> mdspan<remove_pointer_t<remove_reference_t<_Pointer>>, extents<size_t>>;
-
-template <class _CArray>
- requires(is_array_v<_CArray> && (rank_v<_CArray> == 1))
-mdspan(_CArray&) -> mdspan<remove_all_extents_t<_CArray>, extents<size_t, extent_v<_CArray, 0>>>;
-
-template <class _ElementType, class _OtherIndexType, size_t _Size>
-mdspan(_ElementType*, const array<_OtherIndexType, _Size>&) -> mdspan<_ElementType, dextents<size_t, _Size>>;
-
-template <class _ElementType, class _OtherIndexType, size_t _Size>
-mdspan(_ElementType*, span<_OtherIndexType, _Size>) -> mdspan<_ElementType, dextents<size_t, _Size>>;
-
-// This one is necessary because all the constructors take `data_handle_type`s, not
-// `_ElementType*`s, and `data_handle_type` is taken from `accessor_type::data_handle_type`, which
-// seems to throw off automatic deduction guides.
-template <class _ElementType, class _OtherIndexType, size_t... _ExtentsPack>
-mdspan(_ElementType*, const extents<_OtherIndexType, _ExtentsPack...>&)
- -> mdspan<_ElementType, extents<_OtherIndexType, _ExtentsPack...>>;
-
-template <class _ElementType, class _MappingType>
-mdspan(_ElementType*, const _MappingType&)
- -> mdspan<_ElementType, typename _MappingType::extents_type, typename _MappingType::layout_type>;
-
-template <class _MappingType, class _AccessorType>
-mdspan(const typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&)
- -> mdspan<typename _AccessorType::element_type,
- typename _MappingType::extents_type,
- typename _MappingType::layout_type,
- _AccessorType>;
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MDSPAN_MDSPAN_H
diff --git a/libcxx/include/__cxx03/__memory/concepts.h b/libcxx/include/__cxx03/__memory/concepts.h
deleted file mode 100644
index ac57609c0b5c1..0000000000000
--- a/libcxx/include/__cxx03/__memory/concepts.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___MEMORY_CONCEPTS_H
-#define _LIBCPP___CXX03___MEMORY_CONCEPTS_H
-
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h> // TODO(modules): This should not be required
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-// [special.mem.concepts]
-
-// This concept ensures that uninitialized algorithms can construct an object
-// at the address pointed-to by the iterator, which requires an lvalue.
-template <class _Ip>
-concept __nothrow_input_iterator =
- input_iterator<_Ip> && is_lvalue_reference_v<iter_reference_t<_Ip>> &&
- same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>;
-
-template <class _Sp, class _Ip>
-concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>;
-
-template <class _Rp>
-concept __nothrow_input_range =
- range<_Rp> && __nothrow_input_iterator<iterator_t<_Rp>> && __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
-
-template <class _Ip>
-concept __nothrow_forward_iterator =
- __nothrow_input_iterator<_Ip> && forward_iterator<_Ip> && __nothrow_sentinel_for<_Ip, _Ip>;
-
-template <class _Rp>
-concept __nothrow_forward_range = __nothrow_input_range<_Rp> && __nothrow_forward_iterator<iterator_t<_Rp>>;
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___MEMORY_CONCEPTS_H
diff --git a/libcxx/include/__cxx03/__memory/inout_ptr.h b/libcxx/include/__cxx03/__memory/inout_ptr.h
deleted file mode 100644
index 4fea153874030..0000000000000
--- a/libcxx/include/__cxx03/__memory/inout_ptr.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___INOUT_PTR_H
-#define _LIBCPP___CXX03___INOUT_PTR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_specialization.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Smart, class _Pointer, class... _Args>
-class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
- static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr.");
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __smart, _Args... __args)
- : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_([&__smart] {
- if constexpr (is_pointer_v<_Smart>) {
- return __smart;
- } else {
- return __smart.get();
- }
- }()) {
- if constexpr (requires { __s_.release(); }) {
- __s_.release();
- } else {
- __s_ = _Smart();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() {
- // LWG-3897 inout_ptr will not update raw pointer to null
- if constexpr (!is_pointer_v<_Smart>) {
- if (!__p_) {
- return;
- }
- }
-
- using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>;
- if constexpr (is_pointer_v<_Smart>) {
- std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
- std::move(__a_));
- } else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
- std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
- std::move(__a_));
- } else {
- static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>,
- "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
- std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
- std::move(__a_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); }
-
- _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
- requires(!is_same_v<_Pointer, void*>)
- {
- static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer.");
-
- return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
- }
-
-private:
- _Smart& __s_;
- tuple<_Args...> __a_;
- _Pointer __p_;
-};
-
-template <class _Pointer = void, class _Smart, class... _Args>
-_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
- using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
- return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___INOUT_PTR_H
diff --git a/libcxx/include/__cxx03/__memory/out_ptr.h b/libcxx/include/__cxx03/__memory/out_ptr.h
deleted file mode 100644
index 053818bc1f51a..0000000000000
--- a/libcxx/include/__cxx03/__memory/out_ptr.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___OUT_PTR_H
-#define _LIBCPP___CXX03___OUT_PTR_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__type_traits/is_specialization.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Smart, class _Pointer, class... _Args>
-class _LIBCPP_TEMPLATE_VIS out_ptr_t {
- static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0,
- "Using std::shared_ptr<> without a deleter in std::out_ptr is not supported.");
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __smart, _Args... __args)
- : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_() {
- using _Ptr = decltype(__smart);
- if constexpr (__resettable_smart_pointer<_Ptr>) {
- __s_.reset();
- } else if constexpr (is_constructible_v<_Smart>) {
- __s_ = _Smart();
- } else {
- static_assert(__resettable_smart_pointer<_Ptr> || is_constructible_v<_Smart>,
- "The adapted pointer type must have a reset() member function or be default constructible.");
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI out_ptr_t(const out_ptr_t&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI ~out_ptr_t() {
- if (!__p_) {
- return;
- }
-
- using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>;
- if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
- std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
- std::move(__a_));
- } else {
- static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>,
- "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
- std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
- std::move(__a_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); }
-
- _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
- requires(!is_same_v<_Pointer, void*>)
- {
- static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer.");
-
- return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
- }
-
-private:
- _Smart& __s_;
- tuple<_Args...> __a_;
- _Pointer __p_ = _Pointer();
-};
-
-template <class _Pointer = void, class _Smart, class... _Args>
-_LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
- using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
- return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___OUT_PTR_H
diff --git a/libcxx/include/__cxx03/__memory/ranges_construct_at.h b/libcxx/include/__cxx03/__memory/ranges_construct_at.h
deleted file mode 100644
index db271b8572dc6..0000000000000
--- a/libcxx/include/__cxx03/__memory/ranges_construct_at.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___MEMORY_RANGES_CONSTRUCT_AT_H
-#define _LIBCPP___CXX03___MEMORY_RANGES_CONSTRUCT_AT_H
-
-#include <__cxx03/__concepts/destructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/concepts.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/new>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-namespace ranges {
-
-// construct_at
-
-namespace __construct_at {
-
-struct __fn {
- template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator()(_Tp* __location, _Args&&... __args) const {
- return std::construct_at(__location, std::forward<_Args>(__args)...);
- }
-};
-
-} // namespace __construct_at
-
-inline namespace __cpo {
-inline constexpr auto construct_at = __construct_at::__fn{};
-} // namespace __cpo
-
-// destroy_at
-
-namespace __destroy_at {
-
-struct __fn {
- template <destructible _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept {
- std::destroy_at(__location);
- }
-};
-
-} // namespace __destroy_at
-
-inline namespace __cpo {
-inline constexpr auto destroy_at = __destroy_at::__fn{};
-} // namespace __cpo
-
-// destroy
-
-namespace __destroy {
-
-struct __fn {
- template <__nothrow_input_iterator _InputIterator, __nothrow_sentinel_for<_InputIterator> _Sentinel>
- requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept {
- return std::__destroy(std::move(__first), std::move(__last));
- }
-
- template <__nothrow_input_range _InputRange>
- requires destructible<range_value_t<_InputRange>>
- _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_InputRange> operator()(_InputRange&& __range) const noexcept {
- return (*this)(ranges::begin(__range), ranges::end(__range));
- }
-};
-
-} // namespace __destroy
-
-inline namespace __cpo {
-inline constexpr auto destroy = __destroy::__fn{};
-} // namespace __cpo
-
-// destroy_n
-
-namespace __destroy_n {
-
-struct __fn {
- template <__nothrow_input_iterator _InputIterator>
- requires destructible<iter_value_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator
- operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept {
- return std::destroy_n(std::move(__first), __n);
- }
-};
-
-} // namespace __destroy_n
-
-inline namespace __cpo {
-inline constexpr auto destroy_n = __destroy_n::__fn{};
-} // namespace __cpo
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MEMORY_RANGES_CONSTRUCT_AT_H
diff --git a/libcxx/include/__cxx03/__memory/ranges_uninitialized_algorithms.h b/libcxx/include/__cxx03/__memory/ranges_uninitialized_algorithms.h
deleted file mode 100644
index 24e3dfa23180a..0000000000000
--- a/libcxx/include/__cxx03/__memory/ranges_uninitialized_algorithms.h
+++ /dev/null
@@ -1,325 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___MEMORY_RANGES_UNINITIALIZED_ALGORITHMS_H
-#define _LIBCPP___CXX03___MEMORY_RANGES_UNINITIALIZED_ALGORITHMS_H
-
-#include <__cxx03/__algorithm/in_out_result.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__memory/concepts.h>
-#include <__cxx03/__memory/uninitialized_algorithms.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/new>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-// uninitialized_default_construct
-
-namespace __uninitialized_default_construct {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
- requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
- }
-
- template <__nothrow_forward_range _ForwardRange>
- requires default_initializable<range_value_t<_ForwardRange>>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const {
- return (*this)(ranges::begin(__range), ranges::end(__range));
- }
-};
-
-} // namespace __uninitialized_default_construct
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_default_construct = __uninitialized_default_construct::__fn{};
-} // namespace __cpo
-
-// uninitialized_default_construct_n
-
-namespace __uninitialized_default_construct_n {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator>
- requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator
- operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
- }
-};
-
-} // namespace __uninitialized_default_construct_n
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_default_construct_n = __uninitialized_default_construct_n::__fn{};
-} // namespace __cpo
-
-// uninitialized_value_construct
-
-namespace __uninitialized_value_construct {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
- requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
- }
-
- template <__nothrow_forward_range _ForwardRange>
- requires default_initializable<range_value_t<_ForwardRange>>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const {
- return (*this)(ranges::begin(__range), ranges::end(__range));
- }
-};
-
-} // namespace __uninitialized_value_construct
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_value_construct = __uninitialized_value_construct::__fn{};
-} // namespace __cpo
-
-// uninitialized_value_construct_n
-
-namespace __uninitialized_value_construct_n {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator>
- requires default_initializable<iter_value_t<_ForwardIterator>>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator
- operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
- }
-};
-
-} // namespace __uninitialized_value_construct_n
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_construct_n::__fn{};
-} // namespace __cpo
-
-// uninitialized_fill
-
-namespace __uninitialized_fill {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp>
- requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_fill<_ValueType>(std::move(__first), std::move(__last), __x);
- }
-
- template <__nothrow_forward_range _ForwardRange, class _Tp>
- requires constructible_from<range_value_t<_ForwardRange>, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range, const _Tp& __x) const {
- return (*this)(ranges::begin(__range), ranges::end(__range), __x);
- }
-};
-
-} // namespace __uninitialized_fill
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_fill = __uninitialized_fill::__fn{};
-} // namespace __cpo
-
-// uninitialized_fill_n
-
-namespace __uninitialized_fill_n {
-
-struct __fn {
- template <__nothrow_forward_iterator _ForwardIterator, class _Tp>
- requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
- _LIBCPP_HIDE_FROM_ABI _ForwardIterator
- operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const {
- using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x);
- }
-};
-
-} // namespace __uninitialized_fill_n
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_fill_n = __uninitialized_fill_n::__fn{};
-} // namespace __cpo
-
-// uninitialized_copy
-
-template <class _InputIterator, class _OutputIterator>
-using uninitialized_copy_result = in_out_result<_InputIterator, _OutputIterator>;
-
-namespace __uninitialized_copy {
-
-struct __fn {
- template <input_iterator _InputIterator,
- sentinel_for<_InputIterator> _Sentinel1,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel2>
- requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
-
- auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
- auto __result = std::__uninitialized_copy<_ValueType>(
- std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_copying);
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <input_range _InputRange, __nothrow_forward_range _OutputRange>
- requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
- operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(
- ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
- }
-};
-
-} // namespace __uninitialized_copy
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_copy = __uninitialized_copy::__fn{};
-} // namespace __cpo
-
-// uninitialized_copy_n
-
-template <class _InputIterator, class _OutputIterator>
-using uninitialized_copy_n_result = in_out_result<_InputIterator, _OutputIterator>;
-
-namespace __uninitialized_copy_n {
-
-struct __fn {
- template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
- requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_copy_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst,
- iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst,
- _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
- auto __result =
- std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying);
- return {std::move(__result.first), std::move(__result.second)};
- }
-};
-
-} // namespace __uninitialized_copy_n
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_copy_n = __uninitialized_copy_n::__fn{};
-} // namespace __cpo
-
-// uninitialized_move
-
-template <class _InputIterator, class _OutputIterator>
-using uninitialized_move_result = in_out_result<_InputIterator, _OutputIterator>;
-
-namespace __uninitialized_move {
-
-struct __fn {
- template <input_iterator _InputIterator,
- sentinel_for<_InputIterator> _Sentinel1,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel2>
- requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
- auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
- auto __result = std::__uninitialized_move<_ValueType>(
- std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move);
- return {std::move(__result.first), std::move(__result.second)};
- }
-
- template <input_range _InputRange, __nothrow_forward_range _OutputRange>
- requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
- operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
- return (*this)(
- ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
- }
-};
-
-} // namespace __uninitialized_move
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_move = __uninitialized_move::__fn{};
-} // namespace __cpo
-
-// uninitialized_move_n
-
-template <class _InputIterator, class _OutputIterator>
-using uninitialized_move_n_result = in_out_result<_InputIterator, _OutputIterator>;
-
-namespace __uninitialized_move_n {
-
-struct __fn {
- template <input_iterator _InputIterator,
- __nothrow_forward_iterator _OutputIterator,
- __nothrow_sentinel_for<_OutputIterator> _Sentinel>
- requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
- _LIBCPP_HIDE_FROM_ABI uninitialized_move_n_result<_InputIterator, _OutputIterator>
- operator()(_InputIterator __ifirst,
- iter_difference_t<_InputIterator> __n,
- _OutputIterator __ofirst,
- _Sentinel __olast) const {
- using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
- auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
- auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
- auto __result = std::__uninitialized_move_n<_ValueType>(
- std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move);
- return {std::move(__result.first), std::move(__result.second)};
- }
-};
-
-} // namespace __uninitialized_move_n
-
-inline namespace __cpo {
-inline constexpr auto uninitialized_move_n = __uninitialized_move_n::__fn{};
-} // namespace __cpo
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MEMORY_RANGES_UNINITIALIZED_ALGORITHMS_H
diff --git a/libcxx/include/__cxx03/__memory/shared_ptr.h b/libcxx/include/__cxx03/__memory/shared_ptr.h
index 5e1f8c1ff7d5e..e2f343ca86e57 100644
--- a/libcxx/include/__cxx03/__memory/shared_ptr.h
+++ b/libcxx/include/__cxx03/__memory/shared_ptr.h
@@ -10,8 +10,6 @@
#ifndef _LIBCPP___CXX03___MEMORY_SHARED_PTR_H
#define _LIBCPP___CXX03___MEMORY_SHARED_PTR_H
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__exception/exception.h>
#include <__cxx03/__functional/binary_function.h>
diff --git a/libcxx/include/__cxx03/__memory/unique_ptr.h b/libcxx/include/__cxx03/__memory/unique_ptr.h
index 415b002997591..45b2f24653645 100644
--- a/libcxx/include/__cxx03/__memory/unique_ptr.h
+++ b/libcxx/include/__cxx03/__memory/unique_ptr.h
@@ -10,9 +10,6 @@
#ifndef _LIBCPP___CXX03___MEMORY_UNIQUE_PTR_H
#define _LIBCPP___CXX03___MEMORY_UNIQUE_PTR_H
-#include <__cxx03/__compare/compare_three_way.h>
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/operations.h>
diff --git a/libcxx/include/__cxx03/__memory/uses_allocator_construction.h b/libcxx/include/__cxx03/__memory/uses_allocator_construction.h
deleted file mode 100644
index 447d2a4e7cce1..0000000000000
--- a/libcxx/include/__cxx03/__memory/uses_allocator_construction.h
+++ /dev/null
@@ -1,247 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H
-#define _LIBCPP___CXX03___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__memory/uses_allocator.h>
-#include <__cxx03/__tuple/tuple_like_no_subrange.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Type>
-inline constexpr bool __is_std_pair = false;
-
-template <class _Type1, class _Type2>
-inline constexpr bool __is_std_pair<pair<_Type1, _Type2>> = true;
-
-template <class _Tp>
-inline constexpr bool __is_cv_std_pair = __is_std_pair<remove_cv_t<_Tp>>;
-
-template <class _Type, class _Alloc, class... _Args, __enable_if_t<!__is_cv_std_pair<_Type>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept {
- if constexpr (!uses_allocator_v<remove_cv_t<_Type>, _Alloc> && is_constructible_v<_Type, _Args...>) {
- return std::forward_as_tuple(std::forward<_Args>(__args)...);
- } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> &&
- is_constructible_v<_Type, allocator_arg_t, const _Alloc&, _Args...>) {
- return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __alloc, std::forward<_Args>(__args)...);
- } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> &&
- is_constructible_v<_Type, _Args..., const _Alloc&>) {
- return std::forward_as_tuple(std::forward<_Args>(__args)..., __alloc);
- } else {
- static_assert(
- sizeof(_Type) + 1 == 0, "If uses_allocator_v<Type> is true, the type has to be allocator-constructible");
- }
-}
-
-template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(
- const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept {
- return std::make_tuple(
- piecewise_construct,
- std::apply(
- [&__alloc](auto&&... __args1) {
- return std::__uses_allocator_construction_args<typename _Pair::first_type>(
- __alloc, std::forward<decltype(__args1)>(__args1)...);
- },
- std::forward<_Tuple1>(__x)),
- std::apply(
- [&__alloc](auto&&... __args2) {
- return std::__uses_allocator_construction_args<typename _Pair::second_type>(
- __alloc, std::forward<decltype(__args2)>(__args2)...);
- },
- std::forward<_Tuple2>(__y)));
-}
-
-template <class _Pair, class _Alloc, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(__alloc, piecewise_construct, tuple<>{}, tuple<>{});
-}
-
-template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc,
- piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__u)),
- std::forward_as_tuple(std::forward<_Vp>(__v)));
-}
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second));
-}
-# endif
-
-template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>& __pair) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second));
-}
-
-template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>&& __pair) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc,
- piecewise_construct,
- std::forward_as_tuple(std::get<0>(std::move(__pair))),
- std::forward_as_tuple(std::get<1>(std::move(__pair))));
-}
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc,
- piecewise_construct,
- std::forward_as_tuple(std::get<0>(std::move(__pair))),
- std::forward_as_tuple(std::get<1>(std::move(__pair))));
-}
-
-template <class _Pair, class _Alloc, __pair_like_no_subrange _PairLike, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, _PairLike&& __p) noexcept {
- return std::__uses_allocator_construction_args<_Pair>(
- __alloc,
- piecewise_construct,
- std::forward_as_tuple(std::get<0>(std::forward<_PairLike>(__p))),
- std::forward_as_tuple(std::get<1>(std::forward<_PairLike>(__p))));
-}
-# endif
-
-namespace __uses_allocator_detail {
-
-template <class _Ap, class _Bp>
-void __fun(const pair<_Ap, _Bp>&);
-
-template <class _Tp>
-decltype(__uses_allocator_detail::__fun(std::declval<_Tp>()), true_type()) __convertible_to_const_pair_ref_impl(int);
-
-template <class>
-false_type __convertible_to_const_pair_ref_impl(...);
-
-template <class _Tp>
-inline constexpr bool __convertible_to_const_pair_ref =
- decltype(__uses_allocator_detail::__convertible_to_const_pair_ref_impl<_Tp>(0))::value;
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Tp, class _Up>
-inline constexpr bool __uses_allocator_constraints =
- __is_cv_std_pair<_Tp> && !__pair_like_no_subrange<_Up> && !__convertible_to_const_pair_ref<_Up>;
-# else
-template <class _Tp, class _Up>
-inline constexpr bool __uses_allocator_constraints = __is_cv_std_pair<_Tp> && !__convertible_to_const_pair_ref<_Up>;
-# endif
-
-} // namespace __uses_allocator_detail
-
-template < class _Pair,
- class _Alloc,
- class _Type,
- __enable_if_t<__uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept;
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args);
-
-template < class _Pair,
- class _Alloc,
- class _Type,
- __enable_if_t< __uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int>>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept {
- struct __pair_constructor {
- using _PairMutable = remove_cv_t<_Pair>;
-
- _LIBCPP_HIDDEN constexpr auto __do_construct(const _PairMutable& __pair) const {
- return std::__make_obj_using_allocator<_PairMutable>(__alloc_, __pair);
- }
-
- _LIBCPP_HIDDEN constexpr auto __do_construct(_PairMutable&& __pair) const {
- return std::__make_obj_using_allocator<_PairMutable>(__alloc_, std::move(__pair));
- }
-
- const _Alloc& __alloc_;
- _Type& __value_;
-
- _LIBCPP_HIDDEN constexpr operator _PairMutable() const { return __do_construct(std::forward<_Type>(__value_)); }
- };
-
- return std::make_tuple(__pair_constructor{__alloc, __value});
-}
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args) {
- return std::make_from_tuple<_Type>(
- std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...));
-}
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr _Type*
-__uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Args&&... __args) {
- return std::apply(
- [&__ptr](auto&&... __xs) { return std::__construct_at(__ptr, std::forward<decltype(__xs)>(__xs)...); },
- std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...));
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept
- -> decltype(std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...)) {
- return /*--*/ std::__uses_allocator_construction_args<_Type>(__alloc, std::forward<_Args>(__args)...);
-}
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr auto make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args)
- -> decltype(std::__make_obj_using_allocator<_Type>(__alloc, std::forward<_Args>(__args)...)) {
- return /*--*/ std::__make_obj_using_allocator<_Type>(__alloc, std::forward<_Args>(__args)...);
-}
-
-template <class _Type, class _Alloc, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Args&&... __args)
- -> decltype(std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...)) {
- return /*--*/ std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H
diff --git a/libcxx/include/__cxx03/__memory_resource/memory_resource.h b/libcxx/include/__cxx03/__memory_resource/memory_resource.h
deleted file mode 100644
index 6bcad87edd407..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/memory_resource.h
+++ /dev/null
@@ -1,88 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_MEMORY_RESOURCE_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_MEMORY_RESOURCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/memory_resource.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.res.class]
-
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource {
- static const size_t __max_align = alignof(max_align_t);
-
-public:
- virtual ~memory_resource();
-
- [[nodiscard]] [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]]
- _LIBCPP_HIDE_FROM_ABI void* allocate(size_t __bytes, size_t __align = __max_align) {
- return do_allocate(__bytes, __align);
- }
-
- [[__gnu__::__nonnull__]] _LIBCPP_HIDE_FROM_ABI void
- deallocate(void* __p, size_t __bytes, size_t __align = __max_align) {
- do_deallocate(__p, __bytes, __align);
- }
-
- _LIBCPP_HIDE_FROM_ABI bool is_equal(const memory_resource& __other) const noexcept { return do_is_equal(__other); }
-
-private:
- virtual void* do_allocate(size_t, size_t) = 0;
- virtual void do_deallocate(void*, size_t, size_t) = 0;
- virtual bool do_is_equal(memory_resource const&) const noexcept = 0;
-};
-
-// [mem.res.eq]
-
-inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool
-operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
- return &__lhs == &__rhs || __lhs.is_equal(__rhs);
-}
-
-# if _LIBCPP_STD_VER <= 17
-
-inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool
-operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
- return !(__lhs == __rhs);
-}
-
-# endif
-
-// [mem.res.global]
-
-[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
-get_default_resource() noexcept;
-
-[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
-set_default_resource(memory_resource*) noexcept;
-
-[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
-new_delete_resource() noexcept;
-
-[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource*
-null_memory_resource() noexcept;
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_MEMORY_RESOURCE_H
diff --git a/libcxx/include/__cxx03/__memory_resource/monotonic_buffer_resource.h b/libcxx/include/__cxx03/__memory_resource/monotonic_buffer_resource.h
deleted file mode 100644
index f72f56ef05fc6..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/monotonic_buffer_resource.h
+++ /dev/null
@@ -1,122 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory_resource/memory_resource.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.res.monotonic.buffer]
-
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI monotonic_buffer_resource : public memory_resource {
- static const size_t __default_buffer_capacity = 1024;
- static const size_t __default_buffer_alignment = 16;
-
- struct __chunk_footer {
- __chunk_footer* __next_;
- char* __start_;
- char* __cur_;
- size_t __align_;
- _LIBCPP_HIDE_FROM_ABI size_t __allocation_size() {
- return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this);
- }
- void* __try_allocate_from_chunk(size_t, size_t);
- };
-
- struct __initial_descriptor {
- char* __start_;
- char* __cur_;
- union {
- char* __end_;
- size_t __size_;
- };
- void* __try_allocate_from_chunk(size_t, size_t);
- };
-
-public:
- _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource()
- : monotonic_buffer_resource(nullptr, __default_buffer_capacity, get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit monotonic_buffer_resource(size_t __initial_size)
- : monotonic_buffer_resource(nullptr, __initial_size, get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(void* __buffer, size_t __buffer_size)
- : monotonic_buffer_resource(__buffer, __buffer_size, get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit monotonic_buffer_resource(memory_resource* __upstream)
- : monotonic_buffer_resource(nullptr, __default_buffer_capacity, __upstream) {}
-
- _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(size_t __initial_size, memory_resource* __upstream)
- : monotonic_buffer_resource(nullptr, __initial_size, __upstream) {}
-
- _LIBCPP_HIDE_FROM_ABI monotonic_buffer_resource(void* __buffer, size_t __buffer_size, memory_resource* __upstream)
- : __res_(__upstream) {
- __initial_.__start_ = static_cast<char*>(__buffer);
- if (__buffer != nullptr) {
- __initial_.__cur_ = static_cast<char*>(__buffer) + __buffer_size;
- __initial_.__end_ = static_cast<char*>(__buffer) + __buffer_size;
- } else {
- __initial_.__cur_ = nullptr;
- __initial_.__size_ = __buffer_size;
- }
- __chunks_ = nullptr;
- }
-
- monotonic_buffer_resource(const monotonic_buffer_resource&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~monotonic_buffer_resource() override { release(); }
-
- monotonic_buffer_resource& operator=(const monotonic_buffer_resource&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI void release() {
- if (__initial_.__start_ != nullptr)
- __initial_.__cur_ = __initial_.__end_;
- while (__chunks_ != nullptr) {
- __chunk_footer* __next = __chunks_->__next_;
- __res_->deallocate(__chunks_->__start_, __chunks_->__allocation_size(), __chunks_->__align_);
- __chunks_ = __next;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
-
-protected:
- void* do_allocate(size_t __bytes, size_t __alignment) override; // key function
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void*, size_t, size_t) override {}
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
- return this == std::addressof(__other);
- }
-
-private:
- __initial_descriptor __initial_;
- __chunk_footer* __chunks_;
- memory_resource* __res_;
-};
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
diff --git a/libcxx/include/__cxx03/__memory_resource/polymorphic_allocator.h b/libcxx/include/__cxx03/__memory_resource/polymorphic_allocator.h
deleted file mode 100644
index 154f6f0f6973b..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/polymorphic_allocator.h
+++ /dev/null
@@ -1,231 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/pair.h>
-#include <__cxx03/__memory_resource/memory_resource.h>
-#include <__cxx03/__utility/exception_guard.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-#include <__cxx03/new>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.poly.allocator.class]
-
-template <class _ValueType
-# if _LIBCPP_STD_VER >= 20
- = byte
-# endif
- >
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
-
-public:
- using value_type = _ValueType;
-
- // [mem.poly.allocator.ctor]
-
- _LIBCPP_HIDE_FROM_ABI polymorphic_allocator() noexcept : __res_(std::pmr::get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(memory_resource* __r) noexcept : __res_(__r) {}
-
- _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator&) = default;
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator<_Tp>& __other) noexcept
- : __res_(__other.resource()) {}
-
- polymorphic_allocator& operator=(const polymorphic_allocator&) = delete;
-
- // [mem.poly.allocator.mem]
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) {
- if (__n > __max_size()) {
- __throw_bad_array_new_length();
- }
- return static_cast<_ValueType*>(__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType)));
- }
-
- _LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) {
- _LIBCPP_ASSERT_VALID_DEALLOCATION(
- __n <= __max_size(),
- "deallocate() called for a size which exceeds max_size(), leading to a memory leak "
- "(the argument will overflow and result in too few objects being deleted)");
- __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
- }
-
-# if _LIBCPP_STD_VER >= 20
-
- [[nodiscard]] [[using __gnu__: __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void*
- allocate_bytes(size_t __nbytes, size_t __alignment = alignof(max_align_t)) {
- return __res_->allocate(__nbytes, __alignment);
- }
-
- _LIBCPP_HIDE_FROM_ABI void deallocate_bytes(void* __ptr, size_t __nbytes, size_t __alignment = alignof(max_align_t)) {
- __res_->deallocate(__ptr, __nbytes, __alignment);
- }
-
- template <class _Type>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Type* allocate_object(size_t __n = 1) {
- if (numeric_limits<size_t>::max() / sizeof(_Type) < __n)
- std::__throw_bad_array_new_length();
- return static_cast<_Type*>(allocate_bytes(__n * sizeof(_Type), alignof(_Type)));
- }
-
- template <class _Type>
- _LIBCPP_HIDE_FROM_ABI void deallocate_object(_Type* __ptr, size_t __n = 1) {
- deallocate_bytes(__ptr, __n * sizeof(_Type), alignof(_Type));
- }
-
- template <class _Type, class... _CtorArgs>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Type* new_object(_CtorArgs&&... __ctor_args) {
- _Type* __ptr = allocate_object<_Type>();
- auto __guard = std::__make_exception_guard([&] { deallocate_object(__ptr); });
- construct(__ptr, std::forward<_CtorArgs>(__ctor_args)...);
- __guard.__complete();
- return __ptr;
- }
-
- template <class _Type>
- _LIBCPP_HIDE_FROM_ABI void delete_object(_Type* __ptr) {
- destroy(__ptr);
- deallocate_object(__ptr);
- }
-
-# endif // _LIBCPP_STD_VER >= 20
-
- template <class _Tp, class... _Ts>
- _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Ts&&... __args) {
- std::__user_alloc_construct_impl(
- typename __uses_alloc_ctor<_Tp, polymorphic_allocator&, _Ts...>::type(),
- __p,
- *this,
- std::forward<_Ts>(__args)...);
- }
-
- template <class _T1, class _T2, class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI void
- construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
- ::new ((void*)__p) pair<_T1, _T2>(
- piecewise_construct,
- __transform_tuple(typename __uses_alloc_ctor< _T1, polymorphic_allocator&, _Args1... >::type(),
- std::move(__x),
- typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
- __transform_tuple(typename __uses_alloc_ctor< _T2, polymorphic_allocator&, _Args2... >::type(),
- std::move(__y),
- typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
- }
-
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p) {
- construct(__p, piecewise_construct, tuple<>(), tuple<>());
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __u, _Vp&& __v) {
- construct(__p,
- piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__u)),
- std::forward_as_tuple(std::forward<_Vp>(__v)));
- }
-
- template <class _T1, class _T2, class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_U1, _U2>& __pr) {
- construct(__p, piecewise_construct, std::forward_as_tuple(__pr.first), std::forward_as_tuple(__pr.second));
- }
-
- template <class _T1, class _T2, class _U1, class _U2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_U1, _U2>&& __pr) {
- construct(__p,
- piecewise_construct,
- std::forward_as_tuple(std::forward<_U1>(__pr.first)),
- std::forward_as_tuple(std::forward<_U2>(__pr.second)));
- }
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void destroy(_Tp* __p) {
- __p->~_Tp();
- }
-
- _LIBCPP_HIDE_FROM_ABI polymorphic_allocator select_on_container_copy_construction() const noexcept {
- return polymorphic_allocator();
- }
-
- _LIBCPP_HIDE_FROM_ABI memory_resource* resource() const noexcept { return __res_; }
-
-private:
- template <class... _Args, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
- return std::forward_as_tuple(std::get<_Is>(std::move(__t))...);
- }
-
- template <class... _Args, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
- using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>;
- return _Tup(allocator_arg, *this, std::get<_Is>(std::move(__t))...);
- }
-
- template <class... _Args, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., polymorphic_allocator&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
- using _Tup = tuple<_Args&&..., polymorphic_allocator&>;
- return _Tup(std::get<_Is>(std::move(__t))..., *this);
- }
-
- _LIBCPP_HIDE_FROM_ABI size_t __max_size() const noexcept {
- return numeric_limits<size_t>::max() / sizeof(value_type);
- }
-
- memory_resource* __res_;
-};
-
-// [mem.poly.allocator.eq]
-
-template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept {
- return *__lhs.resource() == *__rhs.resource();
-}
-
-# if _LIBCPP_STD_VER <= 17
-
-template <class _Tp, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept {
- return !(__lhs == __rhs);
-}
-
-# endif
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H
diff --git a/libcxx/include/__cxx03/__memory_resource/pool_options.h b/libcxx/include/__cxx03/__memory_resource/pool_options.h
deleted file mode 100644
index ac00e22bd7f4a..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/pool_options.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_POOL_OPTIONS_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_POOL_OPTIONS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.res.pool.options]
-
-struct _LIBCPP_EXPORTED_FROM_ABI pool_options {
- size_t max_blocks_per_chunk = 0;
- size_t largest_required_pool_block = 0;
-};
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_POOL_OPTIONS_H
diff --git a/libcxx/include/__cxx03/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__cxx03/__memory_resource/synchronized_pool_resource.h
deleted file mode 100644
index c8897a3d0818e..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/synchronized_pool_resource.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory_resource/memory_resource.h>
-#include <__cxx03/__memory_resource/pool_options.h>
-#include <__cxx03/__memory_resource/unsynchronized_pool_resource.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/mutex>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.res.pool.overview]
-
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resource : public memory_resource {
-public:
- _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream)
- : __unsync_(__opts, __upstream) {}
-
- _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource()
- : synchronized_pool_resource(pool_options(), get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit synchronized_pool_resource(memory_resource* __upstream)
- : synchronized_pool_resource(pool_options(), __upstream) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit synchronized_pool_resource(const pool_options& __opts)
- : synchronized_pool_resource(__opts, get_default_resource()) {}
-
- synchronized_pool_resource(const synchronized_pool_resource&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~synchronized_pool_resource() override = default;
-
- synchronized_pool_resource& operator=(const synchronized_pool_resource&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI void release() {
-# if !defined(_LIBCPP_HAS_NO_THREADS)
- unique_lock<mutex> __lk(__mut_);
-# endif
- __unsync_.release();
- }
-
- _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __unsync_.upstream_resource(); }
-
- _LIBCPP_HIDE_FROM_ABI pool_options options() const { return __unsync_.options(); }
-
-protected:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void* do_allocate(size_t __bytes, size_t __align) override {
-# if !defined(_LIBCPP_HAS_NO_THREADS)
- unique_lock<mutex> __lk(__mut_);
-# endif
- return __unsync_.allocate(__bytes, __align);
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void* __p, size_t __bytes, size_t __align) override {
-# if !defined(_LIBCPP_HAS_NO_THREADS)
- unique_lock<mutex> __lk(__mut_);
-# endif
- return __unsync_.deallocate(__p, __bytes, __align);
- }
-
- bool do_is_equal(const memory_resource& __other) const noexcept override; // key function
-
-private:
-# if !defined(_LIBCPP_HAS_NO_THREADS)
- mutex __mut_;
-# endif
- unsynchronized_pool_resource __unsync_;
-};
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
diff --git a/libcxx/include/__cxx03/__memory_resource/unsynchronized_pool_resource.h b/libcxx/include/__cxx03/__memory_resource/unsynchronized_pool_resource.h
deleted file mode 100644
index 690768546ca6f..0000000000000
--- a/libcxx/include/__cxx03/__memory_resource/unsynchronized_pool_resource.h
+++ /dev/null
@@ -1,106 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
-#define _LIBCPP___CXX03___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory_resource/memory_resource.h>
-#include <__cxx03/__memory_resource/pool_options.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace pmr {
-
-// [mem.res.pool.overview]
-
-class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI unsynchronized_pool_resource : public memory_resource {
- class __fixed_pool;
-
- class __adhoc_pool {
- struct __chunk_footer;
- __chunk_footer* __first_;
-
- public:
- _LIBCPP_HIDE_FROM_ABI explicit __adhoc_pool() : __first_(nullptr) {}
-
- void __release_ptr(memory_resource* __upstream);
- void* __do_allocate(memory_resource* __upstream, size_t __bytes, size_t __align);
- void __do_deallocate(memory_resource* __upstream, void* __p, size_t __bytes, size_t __align);
- };
-
- static const size_t __min_blocks_per_chunk = 16;
- static const size_t __min_bytes_per_chunk = 1024;
- static const size_t __max_blocks_per_chunk = (size_t(1) << 20);
- static const size_t __max_bytes_per_chunk = (size_t(1) << 30);
-
- static const int __log2_smallest_block_size = 3;
- static const size_t __smallest_block_size = 8;
- static const size_t __default_largest_block_size = (size_t(1) << 20);
- static const size_t __max_largest_block_size = (size_t(1) << 30);
-
- size_t __pool_block_size(int __i) const;
- int __log2_pool_block_size(int __i) const;
- int __pool_index(size_t __bytes, size_t __align) const;
-
-public:
- unsynchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream);
-
- _LIBCPP_HIDE_FROM_ABI unsynchronized_pool_resource()
- : unsynchronized_pool_resource(pool_options(), get_default_resource()) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit unsynchronized_pool_resource(memory_resource* __upstream)
- : unsynchronized_pool_resource(pool_options(), __upstream) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit unsynchronized_pool_resource(const pool_options& __opts)
- : unsynchronized_pool_resource(__opts, get_default_resource()) {}
-
- unsynchronized_pool_resource(const unsynchronized_pool_resource&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~unsynchronized_pool_resource() override { release(); }
-
- unsynchronized_pool_resource& operator=(const unsynchronized_pool_resource&) = delete;
-
- void release();
-
- _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; }
-
- [[__gnu__::__pure__]] pool_options options() const;
-
-protected:
- void* do_allocate(size_t __bytes, size_t __align) override; // key function
-
- void do_deallocate(void* __p, size_t __bytes, size_t __align) override;
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL bool do_is_equal(const memory_resource& __other) const _NOEXCEPT override {
- return &__other == this;
- }
-
-private:
- memory_resource* __res_;
- __adhoc_pool __adhoc_pool_;
- __fixed_pool* __fixed_pools_;
- int __num_fixed_pools_;
- uint32_t __options_max_blocks_per_chunk_;
-};
-
-} // namespace pmr
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___CXX03___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
diff --git a/libcxx/include/__cxx03/__mutex/once_flag.h b/libcxx/include/__cxx03/__mutex/once_flag.h
index 73c2017f36854..de1d423d7c6ba 100644
--- a/libcxx/include/__cxx03/__mutex/once_flag.h
+++ b/libcxx/include/__cxx03/__mutex/once_flag.h
@@ -10,10 +10,10 @@
#define _LIBCPP___CXX03___MUTEX_ONCE_FLAG_H
#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__memory/shared_ptr.h> // __libcpp_acquire_load
#include <__cxx03/__tuple/tuple_indices.h>
#include <__cxx03/__tuple/tuple_size.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/cstdint>
diff --git a/libcxx/include/__cxx03/__node_handle b/libcxx/include/__cxx03/__node_handle
deleted file mode 100644
index 6b272f9a49fff..0000000000000
--- a/libcxx/include/__cxx03/__node_handle
+++ /dev/null
@@ -1,209 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NODE_HANDLE
-#define _LIBCPP___CXX03___NODE_HANDLE
-
-/*
-
-template<unspecified>
-class node-handle {
-public:
- using value_type = see below; // not present for map containers
- using key_type = see below; // not present for set containers
- using mapped_type = see below; // not present for set containers
- using allocator_type = see below;
-
-private:
- using container_node_type = unspecified; // exposition only
- using ator_traits = allocator_traits<allocator_type>; // exposition only
-
- typename ator_traits::template
- rebind_traits<container_node_type>::pointer ptr_; // exposition only
- optional<allocator_type> alloc_; // exposition only
-
-public:
- // [container.node.cons], constructors, copy, and assignment
- constexpr node-handle() noexcept : ptr_(), alloc_() {}
- node-handle(node-handle&&) noexcept;
- node-handle& operator=(node-handle&&);
-
- // [container.node.dtor], destructor
- ~node-handle();
-
- // [container.node.observers], observers
- value_type& value() const; // not present for map containers
- key_type& key() const; // not present for set containers
- mapped_type& mapped() const; // not present for set containers
-
- allocator_type get_allocator() const;
- explicit operator bool() const noexcept;
- [[nodiscard]] bool empty() const noexcept; // nodiscard since C++20
-
- // [container.node.modifiers], modifiers
- void swap(node-handle&)
- noexcept(ator_traits::propagate_on_container_swap::value ||
- ator_traits::is_always_equal::value);
-
- friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
- x.swap(y);
- }
-};
-
-*/
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__memory/allocator_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-// Specialized in __tree & __hash_table for their _NodeType.
-template <class _NodeType, class _Alloc>
-struct __generic_container_node_destructor;
-
-template <class _NodeType, class _Alloc, template <class, class> class _MapOrSetSpecifics>
-class _LIBCPP_TEMPLATE_VIS __basic_node_handle
- : public _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>> {
- template <class _Tp, class _Compare, class _Allocator>
- friend class __tree;
- template <class _Tp, class _Hash, class _Equal, class _Allocator>
- friend class __hash_table;
- friend struct _MapOrSetSpecifics< _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
-
- typedef allocator_traits<_Alloc> __alloc_traits;
- typedef __rebind_pointer_t<typename __alloc_traits::void_pointer, _NodeType> __node_pointer_type;
-
-public:
- typedef _Alloc allocator_type;
-
-private:
- __node_pointer_type __ptr_ = nullptr;
- optional<allocator_type> __alloc_;
-
- _LIBCPP_HIDE_FROM_ABI void __release_ptr() {
- __ptr_ = nullptr;
- __alloc_ = std::nullopt;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
- if (__ptr_ != nullptr) {
- typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
- __node_alloc_type __alloc(*__alloc_);
- __generic_container_node_destructor<_NodeType, __node_alloc_type>(__alloc, true)(__ptr_);
- __ptr_ = nullptr;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
- : __ptr_(__ptr), __alloc_(__alloc) {}
-
-public:
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
-
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
- : __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
- }
-
- _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
- __alloc_ == __other.__alloc_,
- "node_type with incompatible allocator passed to "
- "node_type::operator=(node_type&&)");
-
- __destroy_node_pointer();
- __ptr_ = __other.__ptr_;
-
- if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt)
- __alloc_ = std::move(__other.__alloc_);
-
- __other.__ptr_ = nullptr;
- __other.__alloc_ = std::nullopt;
-
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
-
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
- __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
- using std::swap;
- swap(__ptr_, __other.__ptr_);
- if (__alloc_traits::propagate_on_container_swap::value || __alloc_ == std::nullopt ||
- __other.__alloc_ == std::nullopt)
- swap(__alloc_, __other.__alloc_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend void
- swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
- __a.swap(__b);
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
-};
-
-template <class _NodeType, class _Derived>
-struct __set_node_handle_specifics {
- typedef typename _NodeType::__node_value_type value_type;
-
- _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
-};
-
-template <class _NodeType, class _Derived>
-struct __map_node_handle_specifics {
- typedef typename _NodeType::__node_value_type::key_type key_type;
- typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
-
- _LIBCPP_HIDE_FROM_ABI key_type& key() const {
- return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().first;
- }
-
- _LIBCPP_HIDE_FROM_ABI mapped_type& mapped() const {
- return static_cast<_Derived const*>(this)->__ptr_->__get_value().__ref().second;
- }
-};
-
-template <class _NodeType, class _Alloc>
-using __set_node_handle = __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
-
-template <class _NodeType, class _Alloc>
-using __map_node_handle = __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
-
-template <class _Iterator, class _NodeType>
-struct _LIBCPP_TEMPLATE_VIS __insert_return_type {
- _Iterator position;
- bool inserted;
- _NodeType node;
-};
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NODE_HANDLE
diff --git a/libcxx/include/__cxx03/__numeric/exclusive_scan.h b/libcxx/include/__cxx03/__numeric/exclusive_scan.h
deleted file mode 100644
index 877deb22fc33d..0000000000000
--- a/libcxx/include/__cxx03/__numeric/exclusive_scan.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_EXCLUSIVE_SCAN_H
-#define _LIBCPP___CXX03___NUMERIC_EXCLUSIVE_SCAN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) {
- if (__first != __last) {
- _Tp __tmp(__b(__init, *__first));
- while (true) {
- *__result = std::move(__init);
- ++__result;
- ++__first;
- if (__first == __last)
- break;
- __init = std::move(__tmp);
- __tmp = __b(__init, *__first);
- }
- }
- return __result;
-}
-
-template <class _InputIterator, class _OutputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) {
- return std::exclusive_scan(__first, __last, __result, __init, std::plus<>());
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_EXCLUSIVE_SCAN_H
diff --git a/libcxx/include/__cxx03/__numeric/gcd_lcm.h b/libcxx/include/__cxx03/__numeric/gcd_lcm.h
deleted file mode 100644
index e6d3b78fdfdd6..0000000000000
--- a/libcxx/include/__cxx03/__numeric/gcd_lcm.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_GCD_LCM_H
-#define _LIBCPP___CXX03___NUMERIC_GCD_LCM_H
-
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/countr.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_signed.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value>
-struct __ct_abs;
-
-template <typename _Result, typename _Source>
-struct __ct_abs<_Result, _Source, true> {
- constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
- if (__t >= 0)
- return __t;
- if (__t == numeric_limits<_Source>::min())
- return -static_cast<_Result>(__t);
- return -__t;
- }
-};
-
-template <typename _Result, typename _Source>
-struct __ct_abs<_Result, _Source, false> {
- constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
-};
-
-template <class _Tp>
-constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
- static_assert(!is_signed<_Tp>::value, "");
-
- // From: https://lemire.me/blog/2013/12/26/fastest-way-to-compute-the-greatest-common-divisor
- //
- // If power of two divides both numbers, we can push it out.
- // - gcd( 2^x * a, 2^x * b) = 2^x * gcd(a, b)
- //
- // If and only if exactly one number is even, we can divide that number by that power.
- // - if a, b are odd, then gcd(2^x * a, b) = gcd(a, b)
- //
- // And standard gcd algorithm where instead of modulo, minus is used.
-
- if (__a < __b) {
- _Tp __tmp = __b;
- __b = __a;
- __a = __tmp;
- }
- if (__b == 0)
- return __a;
- __a %= __b; // Make both argument of the same size, and early result in the easy case.
- if (__a == 0)
- return __b;
-
- int __az = std::__countr_zero(__a);
- int __bz = std::__countr_zero(__b);
- int __shift = std::min(__az, __bz);
- __a >>= __az;
- __b >>= __bz;
- do {
- _Tp __diff = __a - __b;
- if (__a > __b) {
- __a = __b;
- __b = __diff;
- } else {
- __b = __b - __a;
- }
- if (__diff != 0)
- __b >>= std::__countr_zero(__diff);
- } while (__b != 0);
- return __a << __shift;
-}
-
-template <class _Tp, class _Up>
-constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
- static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types");
- static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool");
- static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool");
- using _Rp = common_type_t<_Tp, _Up>;
- using _Wp = make_unsigned_t<_Rp>;
- return static_cast<_Rp>(
- std::__gcd(static_cast<_Wp>(__ct_abs<_Rp, _Tp>()(__m)), static_cast<_Wp>(__ct_abs<_Rp, _Up>()(__n))));
-}
-
-template <class _Tp, class _Up>
-constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
- static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types");
- static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool");
- static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool");
- if (__m == 0 || __n == 0)
- return 0;
-
- using _Rp = common_type_t<_Tp, _Up>;
- _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
- _Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
- _Rp __res;
- [[maybe_unused]] bool __overflow = __builtin_mul_overflow(__val1, __val2, &__res);
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__overflow, "Overflow in lcm");
- return __res;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_GCD_LCM_H
diff --git a/libcxx/include/__cxx03/__numeric/inclusive_scan.h b/libcxx/include/__cxx03/__numeric/inclusive_scan.h
deleted file mode 100644
index 5cac37dfc7b0d..0000000000000
--- a/libcxx/include/__cxx03/__numeric/inclusive_scan.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_INCLUSIVE_SCAN_H
-#define _LIBCPP___CXX03___NUMERIC_INCLUSIVE_SCAN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _Tp __init) {
- for (; __first != __last; ++__first, (void)++__result) {
- __init = __b(__init, *__first);
- *__result = __init;
- }
- return __result;
-}
-
-template <class _InputIterator, class _OutputIterator, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b) {
- if (__first != __last) {
- typename iterator_traits<_InputIterator>::value_type __init = *__first;
- *__result++ = __init;
- if (++__first != __last)
- return std::inclusive_scan(__first, __last, __result, __b, __init);
- }
-
- return __result;
-}
-
-template <class _InputIterator, class _OutputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-inclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
- return std::inclusive_scan(__first, __last, __result, std::plus<>());
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___NUMERIC_INCLUSIVE_SCAN_H
diff --git a/libcxx/include/__cxx03/__numeric/midpoint.h b/libcxx/include/__cxx03/__numeric/midpoint.h
deleted file mode 100644
index 91771df1f77b4..0000000000000
--- a/libcxx/include/__cxx03/__numeric/midpoint.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_MIDPOINT_H
-#define _LIBCPP___CXX03___NUMERIC_MIDPOINT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_floating_point.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/__type_traits/is_null_pointer.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp>
-midpoint(_Tp __a, _Tp __b) noexcept _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK {
- using _Up = make_unsigned_t<_Tp>;
- constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
-
- _Up __diff = _Up(__b) - _Up(__a);
- _Up __sign_bit = __b < __a;
-
- _Up __half_diff = (__diff / 2) + (__sign_bit << __bitshift) + (__sign_bit & __diff);
-
- return __a + __half_diff;
-}
-
-template <class _Tp, enable_if_t<is_object_v<_Tp> && !is_void_v<_Tp> && (sizeof(_Tp) > 0), int> = 0>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp* midpoint(_Tp* __a, _Tp* __b) noexcept {
- return __a + std::midpoint(ptrdiff_t(0), __b - __a);
-}
-
-template <typename _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr int __sign(_Tp __val) {
- return (_Tp(0) < __val) - (__val < _Tp(0));
-}
-
-template <typename _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Fp __fp_abs(_Fp __f) {
- return __f >= 0 ? __f : -__f;
-}
-
-template <class _Fp>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<is_floating_point_v<_Fp>, _Fp> midpoint(_Fp __a, _Fp __b) noexcept {
- constexpr _Fp __lo = numeric_limits<_Fp>::min() * 2;
- constexpr _Fp __hi = numeric_limits<_Fp>::max() / 2;
-
- // typical case: overflow is impossible
- if (std::__fp_abs(__a) <= __hi && std::__fp_abs(__b) <= __hi)
- return (__a + __b) / 2; // always correctly rounded
- if (std::__fp_abs(__a) < __lo)
- return __a + __b / 2; // not safe to halve a
- if (std::__fp_abs(__b) < __lo)
- return __a / 2 + __b; // not safe to halve b
-
- return __a / 2 + __b / 2; // otherwise correctly rounded
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_MIDPOINT_H
diff --git a/libcxx/include/__cxx03/__numeric/pstl.h b/libcxx/include/__cxx03/__numeric/pstl.h
deleted file mode 100644
index 3311b40663549..0000000000000
--- a/libcxx/include/__cxx03/__numeric/pstl.h
+++ /dev/null
@@ -1,174 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___NUMERIC_PSTL_H
-#define _LIBCPP___CXX03___NUMERIC_PSTL_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-# include <__cxx03/__functional/identity.h>
-# include <__cxx03/__functional/operations.h>
-# include <__cxx03/__iterator/cpp17_iterator_concepts.h>
-# include <__cxx03/__iterator/iterator_traits.h>
-# include <__cxx03/__pstl/backend.h>
-# include <__cxx03/__pstl/dispatch.h>
-# include <__cxx03/__pstl/handle_exception.h>
-# include <__cxx03/__type_traits/enable_if.h>
-# include <__cxx03/__type_traits/is_execution_policy.h>
-# include <__cxx03/__type_traits/remove_cvref.h>
-# include <__cxx03/__utility/forward.h>
-# include <__cxx03/__utility/move.h>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _BinaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp reduce(
- _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- std::move(__init),
- std::move(__op));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp
-reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__init), plus{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_value_type<_ForwardIterator>
-reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- __iter_value_type<_ForwardIterator>(),
- plus{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
- _ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Tp __init,
- _BinaryOperation1 __reduce,
- _BinaryOperation2 __transform) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators");
- using _Implementation =
- __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__init),
- std::move(__reduce),
- std::move(__transform));
-}
-
-// This overload doesn't get a customization point because it's trivial to detect (through e.g.
-// __desugars_to_v) when specializing the more general variant, which should always be preferred
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
- _ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Tp __init) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators");
- using _Implementation =
- __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__init),
- plus{},
- multiplies{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _BinaryOperation,
- class _UnaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Tp __init,
- _BinaryOperation __reduce,
- _UnaryOperation __transform) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform_reduce requires ForwardIterators");
- using _Implementation = __pstl::__dispatch<__pstl::__transform_reduce, __pstl::__current_configuration, _RawPolicy>;
- return __pstl::__handle_exception<_Implementation>(
- std::forward<_ExecutionPolicy>(__policy),
- std::move(__first),
- std::move(__last),
- std::move(__init),
- std::move(__reduce),
- std::move(__transform));
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_PSTL_H
diff --git a/libcxx/include/__cxx03/__numeric/reduce.h b/libcxx/include/__cxx03/__numeric/reduce.h
deleted file mode 100644
index 628951371f959..0000000000000
--- a/libcxx/include/__cxx03/__numeric/reduce.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_REDUCE_H
-#define _LIBCPP___CXX03___NUMERIC_REDUCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-template <class _InputIterator, class _Tp, class _BinaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
-reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
- for (; __first != __last; ++__first)
- __init = __b(std::move(__init), *__first);
- return __init;
-}
-
-template <class _InputIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
-reduce(_InputIterator __first, _InputIterator __last, _Tp __init) {
- return std::reduce(__first, __last, __init, std::plus<>());
-}
-
-template <class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type
-reduce(_InputIterator __first, _InputIterator __last) {
- return std::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{});
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_REDUCE_H
diff --git a/libcxx/include/__cxx03/__numeric/saturation_arithmetic.h b/libcxx/include/__cxx03/__numeric/saturation_arithmetic.h
deleted file mode 100644
index d4da500beaa10..0000000000000
--- a/libcxx/include/__cxx03/__numeric/saturation_arithmetic.h
+++ /dev/null
@@ -1,145 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_SATURATION_ARITHMETIC_H
-#define _LIBCPP___CXX03___NUMERIC_SATURATION_ARITHMETIC_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__utility/cmp.h>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept {
- if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum))
- return __sum;
- // Handle overflow
- if constexpr (__libcpp_unsigned_integer<_Tp>) {
- return std::numeric_limits<_Tp>::max();
- } else {
- // Signed addition overflow
- if (__x > 0)
- // Overflows if (x > 0 && y > 0)
- return std::numeric_limits<_Tp>::max();
- else
- // Overflows if (x < 0 && y < 0)
- return std::numeric_limits<_Tp>::min();
- }
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept {
- if (_Tp __sub; !__builtin_sub_overflow(__x, __y, &__sub))
- return __sub;
- // Handle overflow
- if constexpr (__libcpp_unsigned_integer<_Tp>) {
- // Overflows if (x < y)
- return std::numeric_limits<_Tp>::min();
- } else {
- // Signed subtration overflow
- if (__x >= 0)
- // Overflows if (x >= 0 && y < 0)
- return std::numeric_limits<_Tp>::max();
- else
- // Overflows if (x < 0 && y > 0)
- return std::numeric_limits<_Tp>::min();
- }
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept {
- if (_Tp __mul; !__builtin_mul_overflow(__x, __y, &__mul))
- return __mul;
- // Handle overflow
- if constexpr (__libcpp_unsigned_integer<_Tp>) {
- return std::numeric_limits<_Tp>::max();
- } else {
- // Signed multiplication overflow
- if ((__x > 0 && __y > 0) || (__x < 0 && __y < 0))
- return std::numeric_limits<_Tp>::max();
- // Overflows if (x < 0 && y > 0) || (x > 0 && y < 0)
- return std::numeric_limits<_Tp>::min();
- }
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined");
- if constexpr (__libcpp_unsigned_integer<_Tp>) {
- return __x / __y;
- } else {
- // Handle signed division overflow
- if (__x == std::numeric_limits<_Tp>::min() && __y == _Tp{-1})
- return std::numeric_limits<_Tp>::max();
- return __x / __y;
- }
-}
-
-template <__libcpp_integer _Rp, __libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept {
- // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be
- // optimized out by the compiler.
-
- // Handle overflow
- if (std::cmp_less(__x, std::numeric_limits<_Rp>::min()))
- return std::numeric_limits<_Rp>::min();
- if (std::cmp_greater(__x, std::numeric_limits<_Rp>::max()))
- return std::numeric_limits<_Rp>::max();
- // No overflow
- return static_cast<_Rp>(__x);
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#if _LIBCPP_STD_VER >= 26
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
- return std::__add_sat(__x, __y);
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
- return std::__sub_sat(__x, __y);
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
- return std::__mul_sat(__x, __y);
-}
-
-template <__libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
- return std::__div_sat(__x, __y);
-}
-
-template <__libcpp_integer _Rp, __libcpp_integer _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {
- return std::__saturate_cast<_Rp>(__x);
-}
-
-#endif // _LIBCPP_STD_VER >= 26
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_SATURATION_ARITHMETIC_H
diff --git a/libcxx/include/__cxx03/__numeric/transform_exclusive_scan.h b/libcxx/include/__cxx03/__numeric/transform_exclusive_scan.h
deleted file mode 100644
index 034c7c929964e..0000000000000
--- a/libcxx/include/__cxx03/__numeric/transform_exclusive_scan.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H
-#define _LIBCPP___CXX03___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_exclusive_scan(
- _InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
- if (__first != __last) {
- _Tp __saved = __init;
- do {
- __init = __b(__init, __u(*__first));
- *__result = __saved;
- __saved = __init;
- ++__result;
- } while (++__first != __last);
- }
- return __result;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_H
diff --git a/libcxx/include/__cxx03/__numeric/transform_inclusive_scan.h b/libcxx/include/__cxx03/__numeric/transform_inclusive_scan.h
deleted file mode 100644
index 00e9b1675b69f..0000000000000
--- a/libcxx/include/__cxx03/__numeric/transform_inclusive_scan.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H
-#define _LIBCPP___CXX03___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/iterator_traits.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
- _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init) {
- for (; __first != __last; ++__first, (void)++__result) {
- __init = __b(__init, __u(*__first));
- *__result = __init;
- }
-
- return __result;
-}
-
-template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator transform_inclusive_scan(
- _InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOp __b, _UnaryOp __u) {
- if (__first != __last) {
- typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
- *__result++ = __init;
- if (++__first != __last)
- return std::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
- }
-
- return __result;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___NUMERIC_TRANSFORM_INCLUSIVE_SCAN_H
diff --git a/libcxx/include/__cxx03/__numeric/transform_reduce.h b/libcxx/include/__cxx03/__numeric/transform_reduce.h
deleted file mode 100644
index 5ec1a59483f07..0000000000000
--- a/libcxx/include/__cxx03/__numeric/transform_reduce.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___NUMERIC_TRANSFORM_REDUCE_H
-#define _LIBCPP___CXX03___NUMERIC_TRANSFORM_REDUCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
-transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
- for (; __first != __last; ++__first)
- __init = __b(std::move(__init), __u(*__first));
- return __init;
-}
-
-template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
- _InputIterator1 __first1,
- _InputIterator1 __last1,
- _InputIterator2 __first2,
- _Tp __init,
- _BinaryOp1 __b1,
- _BinaryOp2 __b2) {
- for (; __first1 != __last1; ++__first1, (void)++__first2)
- __init = __b1(std::move(__init), __b2(*__first1, *__first2));
- return __init;
-}
-
-template <class _InputIterator1, class _InputIterator2, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
-transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
- return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>());
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___NUMERIC_TRANSFORM_REDUCE_H
diff --git a/libcxx/include/__cxx03/__ostream/print.h b/libcxx/include/__cxx03/__ostream/print.h
deleted file mode 100644
index d7943efd60f80..0000000000000
--- a/libcxx/include/__cxx03/__ostream/print.h
+++ /dev/null
@@ -1,179 +0,0 @@
-//===---------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___OSTREAM_PRINT_H
-#define _LIBCPP___CXX03___OSTREAM_PRINT_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/ostream.h>
-#include <__cxx03/__iterator/ostreambuf_iterator.h>
-#include <__cxx03/__ostream/basic_ostream.h>
-#include <__cxx03/format>
-#include <__cxx03/ios>
-#include <__cxx03/locale>
-#include <__cxx03/print>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
- // [ostream.formatted.print]/3
- // Effects: Behaves as a formatted output function
- // ([ostream.formatted.reqmts]) of os, except that:
- // - failure to generate output is reported as specified below, and
- // - any exception thrown by the call to vformat is propagated without regard
- // to the value of os.exceptions() and without turning on ios_base::badbit
- // in the error state of os.
- // After constructing a sentry object, the function initializes an automatic
- // variable via
- // string out = vformat(os.getloc(), fmt, args);
-
- ostream::sentry __s(__os);
- if (__s) {
- string __o = std::vformat(__os.getloc(), __fmt, __args);
- if (__write_nl)
- __o += '\n';
-
- const char* __str = __o.data();
- size_t __len = __o.size();
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- typedef ostreambuf_iterator<char> _Ip;
- if (std::__pad_and_output(
- _Ip(__os),
- __str,
- (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
- __str + __len,
- __os,
- __os.fill())
- .failed())
- __os.setstate(ios_base::badbit | ios_base::failbit);
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- __os.__set_badbit_and_consider_rethrow();
- }
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- }
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args) {
- std::__vprint_nonunicode(__os, __fmt, __args, false);
-}
-
-// Returns the FILE* associated with the __os.
-// Returns a nullptr when no FILE* is associated with __os.
-// This function is in the dylib since the type of the buffer associated
-// with std::cout, std::cerr, and std::clog is only known in the dylib.
-//
-// This function implements part of the implementation-defined behavior
-// of [ostream.formatted.print]/3
-// If the function is vprint_unicode and os is a stream that refers to
-// a terminal capable of displaying Unicode which is determined in an
-// implementation-defined manner, writes out to the terminal using the
-// native Unicode API;
-// Whether the returned FILE* is "a terminal capable of displaying Unicode"
-// is determined in the same way as the print(FILE*, ...) overloads.
-_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
-# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0
- return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
-# else
- FILE* __file = std::__get_ostream_file(__os);
- if (!__file || !__print::__is_terminal(__file))
- return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
-
- // [ostream.formatted.print]/3
- // If the function is vprint_unicode and os is a stream that refers to a
- // terminal capable of displaying Unicode which is determined in an
- // implementation-defined manner, writes out to the terminal using the
- // native Unicode API; if out contains invalid code units, the behavior is
- // undefined and implementations are encouraged to diagnose it. If the
- // native Unicode API is used, the function flushes os before writing out.
- //
- // This is the path for the native API, start with flushing.
- __os.flush();
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- ostream::sentry __s(__os);
- if (__s) {
-# ifndef _LIBCPP_WIN32API
- __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true);
-# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
- __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true);
-# else
-# error "Windows builds with wchar_t disabled are not supported."
-# endif
- }
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- __os.__set_badbit_and_consider_rethrow();
- }
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
-# endif // _LIBCPP_AVAILABILITY_HAS_PRINT
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(ostream& __os, string_view __fmt, format_args __args) {
- std::__vprint_unicode(__os, __fmt, __args, false);
-}
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
-# ifndef _LIBCPP_HAS_NO_UNICODE
- if constexpr (__print::__use_unicode_execution_charset)
- std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
- else
- std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
-# else // _LIBCPP_HAS_NO_UNICODE
- std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
-# endif // _LIBCPP_HAS_NO_UNICODE
-}
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
-# ifndef _LIBCPP_HAS_NO_UNICODE
- // Note the wording in the Standard is inefficient. The output of
- // std::format is a std::string which is then copied. This solution
- // just appends a newline at the end of the output.
- if constexpr (__print::__use_unicode_execution_charset)
- std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
- else
- std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
-# else // _LIBCPP_HAS_NO_UNICODE
- std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
-# endif // _LIBCPP_HAS_NO_UNICODE
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void println(ostream& __os) {
- std::print(__os, "\n");
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___OSTREAM_PRINT_H
diff --git a/libcxx/include/__cxx03/__pstl/backend.h b/libcxx/include/__cxx03/__pstl/backend.h
deleted file mode 100644
index 7e39c6dbc0f8d..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backend.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_BACKEND_H
-#define _LIBCPP___CXX03___PSTL_BACKEND_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__pstl/backend_fwd.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
-# include <__cxx03/__pstl/backends/default.h>
-# include <__cxx03/__pstl/backends/serial.h>
-#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
-# include <__cxx03/__pstl/backends/default.h>
-# include <__cxx03/__pstl/backends/std_thread.h>
-#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
-# include <__cxx03/__pstl/backends/default.h>
-# include <__cxx03/__pstl/backends/libdispatch.h>
-#endif
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKEND_H
diff --git a/libcxx/include/__cxx03/__pstl/backend_fwd.h b/libcxx/include/__cxx03/__pstl/backend_fwd.h
deleted file mode 100644
index e9abd8e99c73c..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backend_fwd.h
+++ /dev/null
@@ -1,301 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_BACKEND_FWD_H
-#define _LIBCPP___CXX03___PSTL_BACKEND_FWD_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-//
-// This header declares available PSTL backends and the functions that must be implemented in order for the
-// PSTL algorithms to be provided.
-//
-// Backends often do not implement the full set of functions themselves -- a configuration of the PSTL is
-// usually a set of backends "stacked" together which each implement some algorithms under some execution
-// policies. It is only necessary for the "stack" of backends to implement all algorithms under all execution
-// policies, but a single backend is not required to implement everything on its own.
-//
-// The signatures used by each backend function are documented below.
-//
-// Exception handling
-// ==================
-//
-// PSTL backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from
-// their implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions
-// are turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
-// frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
-// the user.
-//
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class... _Backends>
-struct __backend_configuration;
-
-struct __default_backend_tag;
-struct __libdispatch_backend_tag;
-struct __serial_backend_tag;
-struct __std_thread_backend_tag;
-
-#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
-using __current_configuration = __backend_configuration<__serial_backend_tag, __default_backend_tag>;
-#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
-using __current_configuration = __backend_configuration<__std_thread_backend_tag, __default_backend_tag>;
-#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
-using __current_configuration = __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>;
-#else
-
-// ...New vendors can add parallel backends here...
-
-# error "Invalid PSTL backend configuration"
-#endif
-
-template <class _Backend, class _ExecutionPolicy>
-struct __find_if;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<_ForwardIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __find_if_not;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<_ForwardIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __find;
-// template <class _Policy, class _ForwardIterator, class _Tp>
-// optional<_ForwardIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __any_of;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __all_of;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __none_of;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __is_partitioned;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __for_each;
-// template <class _Policy, class _ForwardIterator, class _Function>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __for_each_n;
-// template <class _Policy, class _ForwardIterator, class _Size, class _Function>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _Size __size, _Function __func) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __fill;
-// template <class _Policy, class _ForwardIterator, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __fill_n;
-// template <class _Policy, class _ForwardIterator, class _Size, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __replace;
-// template <class _Policy, class _ForwardIterator, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _Tp const& __old, _Tp const& __new) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __replace_if;
-// template <class _Policy, class _ForwardIterator, class _Predicate, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _Predicate __pred, _Tp const& __new_value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __generate;
-// template <class _Policy, class _ForwardIterator, class _Generator>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __generate_n;
-// template <class _Policy, class _ForwardIterator, class _Size, class _Generator>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __merge;
-// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-// _ForwardIterator2 __first2, _ForwardIterator2 __last2,
-// _ForwardOutIterator __result, _Comp __comp) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __stable_sort;
-// template <class _Policy, class _RandomAccessIterator, class _Comp>
-// optional<__empty>
-// operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __sort;
-// template <class _Policy, class _RandomAccessIterator, class _Comp>
-// optional<__empty>
-// operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __transform;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _ForwardOutIterator __result,
-// _UnaryOperation __op) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __transform_binary;
-// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
-// class _ForwardOutIterator,
-// class _BinaryOperation>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-// _ForwardIterator2 __first2,
-// _ForwardOutIterator __result,
-// _BinaryOperation __op) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __replace_copy_if;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Predicate, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _ForwardOutIterator __out_it,
-// _Predicate __pred,
-// _Tp const& __new_value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __replace_copy;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp>
-// optional<__empty>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _ForwardOutIterator __out_it,
-// _Tp const& __old_value,
-// _Tp const& __new_value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __move;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _ForwardOutIterator __out_it) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __copy;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _ForwardOutIterator __out_it) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __copy_n;
-// template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __rotate_copy;
-// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
-// optional<_ForwardOutIterator>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
-// _ForwardOutIterator __out_it) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __transform_reduce;
-// template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
-// optional<_Tp>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _Tp __init,
-// _BinaryOperation __reduce,
-// _UnaryOperation __transform) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __transform_reduce_binary;
-// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
-// class _Tp, class _BinaryOperation1, class _BinaryOperation2>
-// optional<_Tp> operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-// _ForwardIterator2 __first2,
-// _Tp __init,
-// _BinaryOperation1 __reduce,
-// _BinaryOperation2 __transform) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __count_if;
-// template <class _Policy, class _ForwardIterator, class _Predicate>
-// optional<__iter_diff_t<_ForwardIterator>>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __count;
-// template <class _Policy, class _ForwardIterator, class _Tp>
-// optional<__iter_diff_t<_ForwardIterator>>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __equal_3leg;
-// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-// _ForwardIterator2 __first2,
-// _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __equal;
-// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
-// optional<bool>
-// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
-// _ForwardIterator2 __first2, _ForwardIterator2 __last2,
-// _Predicate __pred) const noexcept;
-
-template <class _Backend, class _ExecutionPolicy>
-struct __reduce;
-// template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation>
-// optional<_Tp>
-// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
-// _Tp __init, _BinaryOperation __op) const noexcept;
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKEND_FWD_H
diff --git a/libcxx/include/__cxx03/__pstl/backends/default.h b/libcxx/include/__cxx03/__pstl/backends/default.h
deleted file mode 100644
index 7f7a5325c7d1c..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backends/default.h
+++ /dev/null
@@ -1,503 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_BACKENDS_DEFAULT_H
-#define _LIBCPP___CXX03___PSTL_BACKENDS_DEFAULT_H
-
-#include <__cxx03/__algorithm/copy_n.h>
-#include <__cxx03/__algorithm/equal.h>
-#include <__cxx03/__algorithm/fill_n.h>
-#include <__cxx03/__algorithm/for_each_n.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/identity.h>
-#include <__cxx03/__functional/not_fn.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/dispatch.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-//
-// This file provides an incomplete PSTL backend that implements all of the PSTL algorithms
-// based on a smaller set of basis operations.
-//
-// It is intended as a building block for other PSTL backends that implement some operations more
-// efficiently but may not want to define the full set of PSTL algorithms.
-//
-// This backend implements all the PSTL algorithms based on the following basis operations:
-//
-// find_if family
-// --------------
-// - find
-// - find_if_not
-// - any_of
-// - all_of
-// - none_of
-// - is_partitioned
-//
-// for_each family
-// ---------------
-// - for_each_n
-// - fill
-// - fill_n
-// - replace
-// - replace_if
-// - generate
-// - generate_n
-//
-// merge family
-// ------------
-// No other algorithms based on merge
-//
-// stable_sort family
-// ------------------
-// - sort
-//
-// transform_reduce and transform_reduce_binary family
-// ---------------------------------------------------
-// - count_if
-// - count
-// - equal(3 legs)
-// - equal
-// - reduce
-//
-// transform and transform_binary family
-// -------------------------------------
-// - replace_copy_if
-// - replace_copy
-// - move
-// - copy
-// - copy_n
-// - rotate_copy
-//
-
-//////////////////////////////////////////////////////////////
-// find_if family
-//////////////////////////////////////////////////////////////
-template <class _ExecutionPolicy>
-struct __find<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept {
- using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
- return _FindIf()(
- __policy, std::move(__first), std::move(__last), [&](__iter_reference<_ForwardIterator> __element) {
- return __element == __value;
- });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __find_if_not<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
- return _FindIf()(__policy, __first, __last, std::not_fn(std::forward<_Pred>(__pred)));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __any_of<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
- auto __res = _FindIf()(__policy, __first, __last, std::forward<_Pred>(__pred));
- if (!__res)
- return nullopt;
- return *__res != __last;
- }
-};
-
-template <class _ExecutionPolicy>
-struct __all_of<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- using _AnyOf = __dispatch<__any_of, __current_configuration, _ExecutionPolicy>;
- auto __res = _AnyOf()(__policy, __first, __last, [&](__iter_reference<_ForwardIterator> __value) {
- return !__pred(__value);
- });
- if (!__res)
- return nullopt;
- return !*__res;
- }
-};
-
-template <class _ExecutionPolicy>
-struct __none_of<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- using _AnyOf = __dispatch<__any_of, __current_configuration, _ExecutionPolicy>;
- auto __res = _AnyOf()(__policy, __first, __last, std::forward<_Pred>(__pred));
- if (!__res)
- return nullopt;
- return !*__res;
- }
-};
-
-template <class _ExecutionPolicy>
-struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- using _FindIfNot = __dispatch<__find_if_not, __current_configuration, _ExecutionPolicy>;
- auto __maybe_first = _FindIfNot()(__policy, std::move(__first), std::move(__last), __pred);
- if (__maybe_first == nullopt)
- return nullopt;
-
- __first = *__maybe_first;
- if (__first == __last)
- return true;
- ++__first;
- using _NoneOf = __dispatch<__none_of, __current_configuration, _ExecutionPolicy>;
- return _NoneOf()(__policy, std::move(__first), std::move(__last), __pred);
- }
-};
-
-//////////////////////////////////////////////////////////////
-// for_each family
-//////////////////////////////////////////////////////////////
-template <class _ExecutionPolicy>
-struct __for_each_n<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Size, class _Function>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _Size __size, _Function __func) const noexcept {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
- _ForwardIterator __last = __first + __size;
- return _ForEach()(__policy, std::move(__first), std::move(__last), std::move(__func));
- } else {
- // Otherwise, use the serial algorithm to avoid doing two passes over the input
- std::for_each_n(std::move(__first), __size, std::move(__func));
- return __empty{};
- }
- }
-};
-
-template <class _ExecutionPolicy>
-struct __fill<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
- using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __value; });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __fill_n<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Size, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- using _Fill = __dispatch<__fill, __current_configuration, _ExecutionPolicy>;
- _ForwardIterator __last = __first + __n;
- return _Fill()(__policy, std::move(__first), std::move(__last), __value);
- } else {
- // Otherwise, use the serial algorithm to avoid doing two passes over the input
- std::fill_n(std::move(__first), __n, __value);
- return optional<__empty>{__empty{}};
- }
- }
-};
-
-template <class _ExecutionPolicy>
-struct __replace<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __old, _Tp const& __new)
- const noexcept {
- using _ReplaceIf = __dispatch<__replace_if, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ReplaceIf()(
- __policy, std::move(__first), std::move(__last), [&](_Ref __element) { return __element == __old; }, __new);
- }
-};
-
-template <class _ExecutionPolicy>
-struct __replace_if<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> operator()(
- _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred, _Tp const& __new_value)
- const noexcept {
- using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) {
- if (__pred(__element))
- __element = __new_value;
- });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __generate<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Generator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Generator&& __gen) const noexcept {
- using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __gen(); });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __generate_n<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Size, class _Generator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _Generator&& __gen) const noexcept {
- using _ForEachN = __dispatch<__for_each_n, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ForEachN()(__policy, std::move(__first), __n, [&](_Ref __element) { __element = __gen(); });
- }
-};
-
-//////////////////////////////////////////////////////////////
-// stable_sort family
-//////////////////////////////////////////////////////////////
-template <class _ExecutionPolicy>
-struct __sort<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _RandomAccessIterator, class _Comp>
- _LIBCPP_HIDE_FROM_ABI optional<__empty> operator()(
- _Policy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&& __comp) const noexcept {
- using _StableSort = __dispatch<__stable_sort, __current_configuration, _ExecutionPolicy>;
- return _StableSort()(__policy, std::move(__first), std::move(__last), std::forward<_Comp>(__comp));
- }
-};
-
-//////////////////////////////////////////////////////////////
-// transform_reduce family
-//////////////////////////////////////////////////////////////
-template <class _ExecutionPolicy>
-struct __count_if<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Predicate>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>> operator()(
- _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred) const noexcept {
- using _TransformReduce = __dispatch<__transform_reduce, __current_configuration, _ExecutionPolicy>;
- using _DiffT = __iter_diff_t<_ForwardIterator>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _TransformReduce()(
- __policy, std::move(__first), std::move(__last), _DiffT{}, std::plus{}, [&](_Ref __element) -> _DiffT {
- return __pred(__element) ? _DiffT(1) : _DiffT(0);
- });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __count<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
- using _CountIf = __dispatch<__count_if, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _CountIf()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) -> bool {
- return __element == __value;
- });
- }
-};
-
-template <class _ExecutionPolicy>
-struct __equal_3leg<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Predicate&& __pred) const noexcept {
- using _TransformReduce = __dispatch<__transform_reduce_binary, __current_configuration, _ExecutionPolicy>;
- return _TransformReduce()(
- __policy,
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- true,
- std::logical_and{},
- std::forward<_Predicate>(__pred));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __equal<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _Predicate&& __pred) const noexcept {
- if constexpr (__has_random_access_iterator_category<_ForwardIterator1>::value &&
- __has_random_access_iterator_category<_ForwardIterator2>::value) {
- if (__last1 - __first1 != __last2 - __first2)
- return false;
- // Fall back to the 3 legged algorithm
- using _Equal3Leg = __dispatch<__equal_3leg, __current_configuration, _ExecutionPolicy>;
- return _Equal3Leg()(
- __policy, std::move(__first1), std::move(__last1), std::move(__first2), std::forward<_Predicate>(__pred));
- } else {
- // If we don't have random access, fall back to the serial algorithm cause we can't do much
- return std::equal(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::forward<_Predicate>(__pred));
- }
- }
-};
-
-template <class _ExecutionPolicy>
-struct __reduce<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_Tp>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation&& __op)
- const noexcept {
- using _TransformReduce = __dispatch<__transform_reduce, __current_configuration, _ExecutionPolicy>;
- return _TransformReduce()(
- __policy,
- std::move(__first),
- std::move(__last),
- std::move(__init),
- std::forward<_BinaryOperation>(__op),
- __identity{});
- }
-};
-
-//////////////////////////////////////////////////////////////
-// transform family
-//////////////////////////////////////////////////////////////
-template <class _ExecutionPolicy>
-struct __replace_copy_if<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Pred, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __out_it,
- _Pred&& __pred,
- _Tp const& __new_value) const noexcept {
- using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- auto __res =
- _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), [&](_Ref __element) {
- return __pred(__element) ? __new_value : __element;
- });
- if (__res == nullopt)
- return nullopt;
- return __empty{};
- }
-};
-
-template <class _ExecutionPolicy>
-struct __replace_copy<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __out_it,
- _Tp const& __old_value,
- _Tp const& __new_value) const noexcept {
- using _ReplaceCopyIf = __dispatch<__replace_copy_if, __current_configuration, _ExecutionPolicy>;
- using _Ref = __iter_reference<_ForwardIterator>;
- return _ReplaceCopyIf()(
- __policy,
- std::move(__first),
- std::move(__last),
- std::move(__out_it),
- [&](_Ref __element) { return __element == __old_value; },
- __new_value);
- }
-};
-
-// TODO: Use the std::copy/move shenanigans to forward to std::memmove
-// Investigate whether we want to still forward to std::transform(policy)
-// in that case for the execution::par part, or whether we actually want
-// to run everything serially in that case.
-template <class _ExecutionPolicy>
-struct __move<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __out_it)
- const noexcept {
- using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
- return _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), [&](auto&& __element) {
- return std::move(__element);
- });
- }
-};
-
-// TODO: Use the std::copy/move shenanigans to forward to std::memmove
-template <class _ExecutionPolicy>
-struct __copy<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __out_it)
- const noexcept {
- using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
- return _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), __identity());
- }
-};
-
-template <class _ExecutionPolicy>
-struct __copy_n<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>;
- _ForwardIterator __last = __first + __n;
- return _Copy()(__policy, std::move(__first), std::move(__last), std::move(__out_it));
- } else {
- // Otherwise, use the serial algorithm to avoid doing two passes over the input
- return std::copy_n(std::move(__first), __n, std::move(__out_it));
- }
- }
-};
-
-template <class _ExecutionPolicy>
-struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __middle,
- _ForwardIterator __last,
- _ForwardOutIterator __out_it) const noexcept {
- using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>;
- auto __result_mid = _Copy()(__policy, __middle, std::move(__last), std::move(__out_it));
- if (__result_mid == nullopt)
- return nullopt;
- return _Copy()(__policy, std::move(__first), std::move(__middle), *std::move(__result_mid));
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKENDS_DEFAULT_H
diff --git a/libcxx/include/__cxx03/__pstl/backends/libdispatch.h b/libcxx/include/__cxx03/__pstl/backends/libdispatch.h
deleted file mode 100644
index 80260ca5b7a5b..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backends/libdispatch.h
+++ /dev/null
@@ -1,397 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_BACKENDS_LIBDISPATCH_H
-#define _LIBCPP___CXX03___PSTL_BACKENDS_LIBDISPATCH_H
-
-#include <__cxx03/__algorithm/inplace_merge.h>
-#include <__cxx03/__algorithm/lower_bound.h>
-#include <__cxx03/__algorithm/max.h>
-#include <__cxx03/__algorithm/merge.h>
-#include <__cxx03/__algorithm/upper_bound.h>
-#include <__cxx03/__atomic/atomic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__exception/terminate.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/move_iterator.h>
-#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__numeric/reduce.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/any_of.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__pstl/cpu_algos/fill.h>
-#include <__cxx03/__pstl/cpu_algos/find_if.h>
-#include <__cxx03/__pstl/cpu_algos/for_each.h>
-#include <__cxx03/__pstl/cpu_algos/merge.h>
-#include <__cxx03/__pstl/cpu_algos/stable_sort.h>
-#include <__cxx03/__pstl/cpu_algos/transform.h>
-#include <__cxx03/__pstl/cpu_algos/transform_reduce.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/__utility/exception_guard.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/new>
-#include <__cxx03/optional>
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-namespace __libdispatch {
-// ::dispatch_apply is marked as __attribute__((nothrow)) because it doesn't let exceptions propagate, and neither do
-// we.
-// TODO: Do we want to add [[_Clang::__callback__(__func, __context, __)]]?
-_LIBCPP_EXPORTED_FROM_ABI void
-__dispatch_apply(size_t __chunk_count, void* __context, void (*__func)(void* __context, size_t __chunk)) noexcept;
-
-template <class _Func>
-_LIBCPP_HIDE_FROM_ABI void __dispatch_apply(size_t __chunk_count, _Func __func) noexcept {
- __libdispatch::__dispatch_apply(__chunk_count, &__func, [](void* __context, size_t __chunk) {
- (*static_cast<_Func*>(__context))(__chunk);
- });
-}
-
-struct __chunk_partitions {
- ptrdiff_t __chunk_count_; // includes the first chunk
- ptrdiff_t __chunk_size_;
- ptrdiff_t __first_chunk_size_;
-};
-
-[[__gnu__::__const__]] _LIBCPP_EXPORTED_FROM_ABI __chunk_partitions __partition_chunks(ptrdiff_t __size) noexcept;
-
-template <class _RandomAccessIterator, class _Functor>
-_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__dispatch_parallel_for(__chunk_partitions __partitions, _RandomAccessIterator __first, _Functor __func) {
- // Perform the chunked execution.
- __libdispatch::__dispatch_apply(__partitions.__chunk_count_, [&](size_t __chunk) {
- auto __this_chunk_size = __chunk == 0 ? __partitions.__first_chunk_size_ : __partitions.__chunk_size_;
- auto __index =
- __chunk == 0
- ? 0
- : (__chunk * __partitions.__chunk_size_) + (__partitions.__first_chunk_size_ - __partitions.__chunk_size_);
- __func(__first + __index, __first + __index + __this_chunk_size);
- });
-
- return __empty{};
-}
-} // namespace __libdispatch
-
-template <>
-struct __cpu_traits<__libdispatch_backend_tag> {
- template <class _RandomAccessIterator, class _Functor>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __for_each(_RandomAccessIterator __first, _RandomAccessIterator __last, _Functor __func) {
- return __libdispatch::__dispatch_parallel_for(
- __libdispatch::__partition_chunks(__last - __first), std::move(__first), std::move(__func));
- }
-
- template <class _RandomAccessIterator1, class _RandomAccessIterator2, class _RandomAccessIteratorOut>
- struct __merge_range {
- __merge_range(_RandomAccessIterator1 __mid1, _RandomAccessIterator2 __mid2, _RandomAccessIteratorOut __result)
- : __mid1_(__mid1), __mid2_(__mid2), __result_(__result) {}
-
- _RandomAccessIterator1 __mid1_;
- _RandomAccessIterator2 __mid2_;
- _RandomAccessIteratorOut __result_;
- };
-
- template <typename _RandomAccessIterator1,
- typename _RandomAccessIterator2,
- typename _RandomAccessIterator3,
- typename _Compare,
- typename _LeafMerge>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __merge(_RandomAccessIterator1 __first1,
- _RandomAccessIterator1 __last1,
- _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2,
- _RandomAccessIterator3 __result,
- _Compare __comp,
- _LeafMerge __leaf_merge) noexcept {
- __libdispatch::__chunk_partitions __partitions =
- __libdispatch::__partition_chunks(std::max<ptrdiff_t>(__last1 - __first1, __last2 - __first2));
-
- if (__partitions.__chunk_count_ == 0)
- return __empty{};
-
- if (__partitions.__chunk_count_ == 1) {
- __leaf_merge(__first1, __last1, __first2, __last2, __result, __comp);
- return __empty{};
- }
-
- using __merge_range_t = __merge_range<_RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator3>;
- auto const __n_ranges = __partitions.__chunk_count_ + 1;
-
- // TODO: use __uninitialized_buffer
- auto __destroy = [=](__merge_range_t* __ptr) {
- std::destroy_n(__ptr, __n_ranges);
- std::allocator<__merge_range_t>().deallocate(__ptr, __n_ranges);
- };
-
- unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
- [&]() -> __merge_range_t* {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-#endif
- return std::allocator<__merge_range_t>().allocate(__n_ranges);
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (const std::bad_alloc&) {
- return nullptr;
- }
-#endif
- }(),
- __destroy);
-
- if (!__ranges)
- return nullopt;
-
- // TODO: Improve the case where the smaller range is merged into just a few (or even one) chunks of the larger case
- __merge_range_t* __r = __ranges.get();
- std::__construct_at(__r++, __first1, __first2, __result);
-
- bool __iterate_first_range = __last1 - __first1 > __last2 - __first2;
-
- auto __compute_chunk = [&](size_t __chunk_size) -> __merge_range_t {
- auto [__mid1, __mid2] = [&] {
- if (__iterate_first_range) {
- auto __m1 = __first1 + __chunk_size;
- auto __m2 = std::lower_bound(__first2, __last2, __m1[-1], __comp);
- return std::make_pair(__m1, __m2);
- } else {
- auto __m2 = __first2 + __chunk_size;
- auto __m1 = std::lower_bound(__first1, __last1, __m2[-1], __comp);
- return std::make_pair(__m1, __m2);
- }
- }();
-
- __result += (__mid1 - __first1) + (__mid2 - __first2);
- __first1 = __mid1;
- __first2 = __mid2;
- return {std::move(__mid1), std::move(__mid2), __result};
- };
-
- // handle first chunk
- std::__construct_at(__r++, __compute_chunk(__partitions.__first_chunk_size_));
-
- // handle 2 -> N - 1 chunks
- for (ptrdiff_t __i = 0; __i != __partitions.__chunk_count_ - 2; ++__i)
- std::__construct_at(__r++, __compute_chunk(__partitions.__chunk_size_));
-
- // handle last chunk
- std::__construct_at(__r, __last1, __last2, __result);
-
- __libdispatch::__dispatch_apply(__partitions.__chunk_count_, [&](size_t __index) {
- auto __first_iters = __ranges[__index];
- auto __last_iters = __ranges[__index + 1];
- __leaf_merge(
- __first_iters.__mid1_,
- __last_iters.__mid1_,
- __first_iters.__mid2_,
- __last_iters.__mid2_,
- __first_iters.__result_,
- __comp);
- });
-
- return __empty{};
- }
-
- template <class _RandomAccessIterator, class _Transform, class _Value, class _Combiner, class _Reduction>
- _LIBCPP_HIDE_FROM_ABI static optional<_Value> __transform_reduce(
- _RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Transform __transform,
- _Value __init,
- _Combiner __combiner,
- _Reduction __reduction) {
- if (__first == __last)
- return __init;
-
- auto __partitions = __libdispatch::__partition_chunks(__last - __first);
-
- auto __destroy = [__count = __partitions.__chunk_count_](_Value* __ptr) {
- std::destroy_n(__ptr, __count);
- std::allocator<_Value>().deallocate(__ptr, __count);
- };
-
- // TODO: use __uninitialized_buffer
- // TODO: allocate one element per worker instead of one element per chunk
- unique_ptr<_Value[], decltype(__destroy)> __values(
- std::allocator<_Value>().allocate(__partitions.__chunk_count_), __destroy);
-
- // __dispatch_apply is noexcept
- __libdispatch::__dispatch_apply(__partitions.__chunk_count_, [&](size_t __chunk) {
- auto __this_chunk_size = __chunk == 0 ? __partitions.__first_chunk_size_ : __partitions.__chunk_size_;
- auto __index = __chunk == 0 ? 0
- : (__chunk * __partitions.__chunk_size_) +
- (__partitions.__first_chunk_size_ - __partitions.__chunk_size_);
- if (__this_chunk_size != 1) {
- std::__construct_at(
- __values.get() + __chunk,
- __reduction(__first + __index + 2,
- __first + __index + __this_chunk_size,
- __combiner(__transform(__first + __index), __transform(__first + __index + 1))));
- } else {
- std::__construct_at(__values.get() + __chunk, __transform(__first + __index));
- }
- });
-
- return std::reduce(
- std::make_move_iterator(__values.get()),
- std::make_move_iterator(__values.get() + __partitions.__chunk_count_),
- std::move(__init),
- __combiner);
- }
-
- template <class _RandomAccessIterator, class _Comp, class _LeafSort>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp, _LeafSort __leaf_sort) {
- const auto __size = __last - __first;
- auto __partitions = __libdispatch::__partition_chunks(__size);
-
- if (__partitions.__chunk_count_ == 0)
- return __empty{};
-
- if (__partitions.__chunk_count_ == 1) {
- __leaf_sort(__first, __last, __comp);
- return __empty{};
- }
-
- using _Value = __iter_value_type<_RandomAccessIterator>;
-
- auto __destroy = [__size](_Value* __ptr) {
- std::destroy_n(__ptr, __size);
- std::allocator<_Value>().deallocate(__ptr, __size);
- };
-
- // TODO: use __uninitialized_buffer
- unique_ptr<_Value[], decltype(__destroy)> __values(std::allocator<_Value>().allocate(__size), __destroy);
-
- // Initialize all elements to a moved-from state
- // TODO: Don't do this - this can be done in the first merge - see https://llvm.org/PR63928
- std::__construct_at(__values.get(), std::move(*__first));
- for (__iter_diff_t<_RandomAccessIterator> __i = 1; __i != __size; ++__i) {
- std::__construct_at(__values.get() + __i, std::move(__values.get()[__i - 1]));
- }
- *__first = std::move(__values.get()[__size - 1]);
-
- __libdispatch::__dispatch_parallel_for(
- __partitions,
- __first,
- [&__leaf_sort, &__comp](_RandomAccessIterator __chunk_first, _RandomAccessIterator __chunk_last) {
- __leaf_sort(std::move(__chunk_first), std::move(__chunk_last), __comp);
- });
-
- bool __objects_are_in_buffer = false;
- do {
- const auto __old_chunk_size = __partitions.__chunk_size_;
- if (__partitions.__chunk_count_ % 2 == 1) {
- auto __inplace_merge_chunks = [&__comp, &__partitions](auto __first_chunk_begin) {
- std::inplace_merge(
- __first_chunk_begin,
- __first_chunk_begin + __partitions.__first_chunk_size_,
- __first_chunk_begin + __partitions.__first_chunk_size_ + __partitions.__chunk_size_,
- __comp);
- };
- if (__objects_are_in_buffer)
- __inplace_merge_chunks(__values.get());
- else
- __inplace_merge_chunks(__first);
- __partitions.__first_chunk_size_ += 2 * __partitions.__chunk_size_;
- } else {
- __partitions.__first_chunk_size_ += __partitions.__chunk_size_;
- }
-
- __partitions.__chunk_size_ *= 2;
- __partitions.__chunk_count_ /= 2;
-
- auto __merge_chunks = [__partitions, __old_chunk_size, &__comp](auto __from_first, auto __to_first) {
- __libdispatch::__dispatch_parallel_for(
- __partitions,
- __from_first,
- [__old_chunk_size, &__from_first, &__to_first, &__comp](auto __chunk_first, auto __chunk_last) {
- std::merge(std::make_move_iterator(__chunk_first),
- std::make_move_iterator(__chunk_last - __old_chunk_size),
- std::make_move_iterator(__chunk_last - __old_chunk_size),
- std::make_move_iterator(__chunk_last),
- __to_first + (__chunk_first - __from_first),
- __comp);
- });
- };
-
- if (__objects_are_in_buffer)
- __merge_chunks(__values.get(), __first);
- else
- __merge_chunks(__first, __values.get());
- __objects_are_in_buffer = !__objects_are_in_buffer;
- } while (__partitions.__chunk_count_ > 1);
-
- if (__objects_are_in_buffer) {
- std::move(__values.get(), __values.get() + __size, __first);
- }
-
- return __empty{};
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __cancel_execution() {}
-
- static constexpr size_t __lane_size = 64;
-};
-
-// Mandatory implementations of the computational basis
-template <class _ExecutionPolicy>
-struct __find_if<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_find_if<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __for_each<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_for_each<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __merge<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_merge<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __stable_sort<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_stable_sort<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_binary<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_binary<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_reduce<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce_binary<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_reduce_binary<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-// Not mandatory, but better optimized
-template <class _ExecutionPolicy>
-struct __any_of<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_any_of<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_fill<__libdispatch_backend_tag, _ExecutionPolicy> {};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKENDS_LIBDISPATCH_H
diff --git a/libcxx/include/__cxx03/__pstl/backends/serial.h b/libcxx/include/__cxx03/__pstl/backends/serial.h
deleted file mode 100644
index d0de7a1177783..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backends/serial.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___PSTL_BACKENDS_SERIAL_H
-#define _LIBCPP___CXX03___PSTL_BACKENDS_SERIAL_H
-
-#include <__cxx03/__algorithm/find_if.h>
-#include <__cxx03/__algorithm/for_each.h>
-#include <__cxx03/__algorithm/merge.h>
-#include <__cxx03/__algorithm/stable_sort.h>
-#include <__cxx03/__algorithm/transform.h>
-#include <__cxx03/__config>
-#include <__cxx03/__numeric/transform_reduce.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-//
-// This partial PSTL backend runs everything serially.
-//
-// TODO: Right now, the serial backend must be used with another backend
-// like the "default backend" because it doesn't implement all the
-// necessary PSTL operations. It would be better to dispatch all
-// algorithms to their serial counterpart directly, since this can
-// often be more efficient than the "default backend"'s implementation
-// if we end up running serially anyways.
-//
-
-template <class _ExecutionPolicy>
-struct __find_if<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Pred>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
- operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
- return std::find_if(std::move(__first), std::move(__last), std::forward<_Pred>(__pred));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __for_each<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Function>
- _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function&& __func) const noexcept {
- std::for_each(std::move(__first), std::move(__last), std::forward<_Function>(__func));
- return __empty{};
- }
-};
-
-template <class _ExecutionPolicy>
-struct __merge<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
- _Policy&&,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __outit,
- _Comp&& __comp) const noexcept {
- return std::merge(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__last2),
- std::move(__outit),
- std::forward<_Comp>(__comp));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __stable_sort<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _RandomAccessIterator, class _Comp>
- _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&& __comp) const noexcept {
- std::stable_sort(std::move(__first), std::move(__last), std::forward<_Comp>(__comp));
- return __empty{};
- }
-};
-
-template <class _ExecutionPolicy>
-struct __transform<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
- _Policy&&, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __outit, _UnaryOperation&& __op)
- const noexcept {
- return std::transform(
- std::move(__first), std::move(__last), std::move(__outit), std::forward<_UnaryOperation>(__op));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __transform_binary<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&&,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardOutIterator __outit,
- _BinaryOperation&& __op) const noexcept {
- return std::transform(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__outit),
- std::forward<_BinaryOperation>(__op));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_Tp>
- operator()(_Policy&&,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Tp __init,
- _BinaryOperation&& __reduce,
- _UnaryOperation&& __transform) const noexcept {
- return std::transform_reduce(
- std::move(__first),
- std::move(__last),
- std::move(__init),
- std::forward<_BinaryOperation>(__reduce),
- std::forward<_UnaryOperation>(__transform));
- }
-};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce_binary<__serial_backend_tag, _ExecutionPolicy> {
- template <class _Policy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2>
- _LIBCPP_HIDE_FROM_ABI optional<_Tp> operator()(
- _Policy&&,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Tp __init,
- _BinaryOperation1&& __reduce,
- _BinaryOperation2&& __transform) const noexcept {
- return std::transform_reduce(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__init),
- std::forward<_BinaryOperation1>(__reduce),
- std::forward<_BinaryOperation2>(__transform));
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKENDS_SERIAL_H
diff --git a/libcxx/include/__cxx03/__pstl/backends/std_thread.h b/libcxx/include/__cxx03/__pstl/backends/std_thread.h
deleted file mode 100644
index 487ddda57aa25..0000000000000
--- a/libcxx/include/__cxx03/__pstl/backends/std_thread.h
+++ /dev/null
@@ -1,136 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_BACKENDS_STD_THREAD_H
-#define _LIBCPP___CXX03___PSTL_BACKENDS_STD_THREAD_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/any_of.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__pstl/cpu_algos/fill.h>
-#include <__cxx03/__pstl/cpu_algos/find_if.h>
-#include <__cxx03/__pstl/cpu_algos/for_each.h>
-#include <__cxx03/__pstl/cpu_algos/merge.h>
-#include <__cxx03/__pstl/cpu_algos/stable_sort.h>
-#include <__cxx03/__pstl/cpu_algos/transform.h>
-#include <__cxx03/__pstl/cpu_algos/transform_reduce.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-//
-// This partial backend implementation is for testing purposes only and not meant for production use. This will be
-// replaced by a proper implementation once the PSTL implementation is somewhat stable.
-//
-// This is intended to be used on top of the "default backend".
-//
-
-template <>
-struct __cpu_traits<__std_thread_backend_tag> {
- template <class _RandomAccessIterator, class _Fp>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __for_each(_RandomAccessIterator __first, _RandomAccessIterator __last, _Fp __f) {
- __f(__first, __last);
- return __empty{};
- }
-
- template <class _Index, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduce>
- _LIBCPP_HIDE_FROM_ABI static optional<_Tp>
- __transform_reduce(_Index __first, _Index __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduce __reduce) {
- return __reduce(std::move(__first), std::move(__last), std::move(__init));
- }
-
- template <class _RandomAccessIterator, class _Compare, class _LeafSort>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, _LeafSort __leaf_sort) {
- __leaf_sort(__first, __last, __comp);
- return __empty{};
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __cancel_execution() {}
-
- template <class _RandomAccessIterator1,
- class _RandomAccessIterator2,
- class _RandomAccessIterator3,
- class _Compare,
- class _LeafMerge>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __merge(_RandomAccessIterator1 __first1,
- _RandomAccessIterator1 __last1,
- _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2,
- _RandomAccessIterator3 __outit,
- _Compare __comp,
- _LeafMerge __leaf_merge) {
- __leaf_merge(__first1, __last1, __first2, __last2, __outit, __comp);
- return __empty{};
- }
-
- static constexpr size_t __lane_size = 64;
-};
-
-// Mandatory implementations of the computational basis
-template <class _ExecutionPolicy>
-struct __find_if<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_find_if<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __for_each<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_for_each<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __merge<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_merge<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __stable_sort<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_stable_sort<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_binary<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_binary<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_reduce<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __transform_reduce_binary<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_transform_reduce_binary<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-// Not mandatory, but better optimized
-template <class _ExecutionPolicy>
-struct __any_of<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_any_of<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-template <class _ExecutionPolicy>
-struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
- : __cpu_parallel_fill<__std_thread_backend_tag, _ExecutionPolicy> {};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_BACKENDS_STD_THREAD_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/any_of.h b/libcxx/include/__cxx03/__pstl/cpu_algos/any_of.h
deleted file mode 100644
index 7828a7026e7d4..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/any_of.h
+++ /dev/null
@@ -1,99 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_ANY_OF_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_ANY_OF_H
-
-#include <__cxx03/__algorithm/any_of.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__atomic/atomic.h>
-#include <__cxx03/__atomic/memory_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/cstdint>
-#include <__cxx03/optional>
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Backend, class _Index, class _Brick>
-_LIBCPP_HIDE_FROM_ABI optional<bool> __parallel_or(_Index __first, _Index __last, _Brick __f) {
- std::atomic<bool> __found(false);
- auto __ret = __cpu_traits<_Backend>::__for_each(__first, __last, [__f, &__found](_Index __i, _Index __j) {
- if (!__found.load(std::memory_order_relaxed) && __f(__i, __j)) {
- __found.store(true, std::memory_order_relaxed);
- __cpu_traits<_Backend>::__cancel_execution();
- }
- });
- if (!__ret)
- return nullopt;
- return static_cast<bool>(__found);
-}
-
-// TODO: check whether __simd_first() can be used here
-template <class _Index, class _DifferenceType, class _Pred>
-_LIBCPP_HIDE_FROM_ABI bool __simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept {
- _DifferenceType __block_size = 4 < __n ? 4 : __n;
- const _Index __last = __first + __n;
- while (__last != __first) {
- int32_t __flag = 1;
- _PSTL_PRAGMA_SIMD_REDUCTION(& : __flag)
- for (_DifferenceType __i = 0; __i < __block_size; ++__i)
- if (__pred(*(__first + __i)))
- __flag = 0;
- if (!__flag)
- return true;
-
- __first += __block_size;
- if (__last - __first >= __block_size << 1) {
- // Double the block _Size. Any unnecessary iterations can be amortized against work done so far.
- __block_size <<= 1;
- } else {
- __block_size = __last - __first;
- }
- }
- return false;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_any_of {
- template <class _Policy, class _ForwardIterator, class _Predicate>
- _LIBCPP_HIDE_FROM_ABI optional<bool>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__parallel_or<_Backend>(
- __first, __last, [&__policy, &__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- using _AnyOfUnseq = __pstl::__any_of<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- auto __res = _AnyOfUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __pred);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__simd_or(__first, __last - __first, __pred);
- } else {
- return std::any_of(__first, __last, __pred);
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_ANY_OF_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/cpu_traits.h b/libcxx/include/__cxx03/__pstl/cpu_algos/cpu_traits.h
deleted file mode 100644
index 770f5dd7b45da..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/cpu_traits.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_CPU_TRAITS_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_CPU_TRAITS_H
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-// __cpu_traits
-//
-// This traits class encapsulates the basis operations for a CPU-based implementation of the PSTL.
-// All the operations in the PSTL can be implemented from these basis operations, so a pure CPU backend
-// only needs to customize these traits in order to get an implementation of the whole PSTL.
-//
-// Basis operations
-// ================
-//
-// template <class _RandomAccessIterator, class _Functor>
-// optional<__empty> __for_each(_RandomAccessIterator __first, _RandomAccessIterator __last, _Functor __func);
-// - __func must take a subrange of [__first, __last) that should be executed in serial
-//
-// template <class _Iterator, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduction>
-// optional<_Tp> __transform_reduce(_Iterator __first, _Iterator __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduction);
-//
-// template <class _RandomAccessIterator1,
-// class _RandomAccessIterator2,
-// class _RandomAccessIterator3,
-// class _Compare,
-// class _LeafMerge>
-// optional<_RandomAccessIterator3> __merge(_RandomAccessIterator1 __first1,
-// _RandomAccessIterator1 __last1,
-// _RandomAccessIterator2 __first2,
-// _RandomAccessIterator2 __last2,
-// _RandomAccessIterator3 __outit,
-// _Compare __comp,
-// _LeafMerge __leaf_merge);
-//
-// template <class _RandomAccessIterator, class _Comp, class _LeafSort>
-// optional<__empty> __stable_sort(_RandomAccessIterator __first,
-// _RandomAccessIterator __last,
-// _Comp __comp,
-// _LeafSort __leaf_sort);
-//
-// void __cancel_execution();
-// Cancel the execution of other jobs - they aren't needed anymore. This is not a binding request,
-// some backends may not actually be able to cancel jobs.
-//
-// constexpr size_t __lane_size;
-// Size of SIMD lanes.
-// TODO: Merge this with __native_vector_size from __algorithm/simd_utils.h
-//
-//
-// Exception handling
-// ==================
-//
-// CPU backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from their
-// implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions are
-// turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
-// frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
-// the user.
-
-template <class _Backend>
-struct __cpu_traits;
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_CPU_TRAITS_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/fill.h b/libcxx/include/__cxx03/__pstl/cpu_algos/fill.h
deleted file mode 100644
index a101efb632e6c..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/fill.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_FILL_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_FILL_H
-
-#include <__cxx03/__algorithm/fill.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Index, class _DifferenceType, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _Index __simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept {
- _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
- _PSTL_PRAGMA_SIMD
- for (_DifferenceType __i = 0; __i < __n; ++__i)
- __first[__i] = __value;
- return __first + __n;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_fill {
- template <class _Policy, class _ForwardIterator, class _Tp>
- _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __cpu_traits<_Backend>::__for_each(
- __first, __last, [&__policy, &__value](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- using _FillUnseq = __pstl::__fill<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- [[maybe_unused]] auto __res =
- _FillUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __value);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- __pstl::__simd_fill_n(__first, __last - __first, __value);
- return __empty{};
- } else {
- std::fill(__first, __last, __value);
- return __empty{};
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_FILL_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/find_if.h b/libcxx/include/__cxx03/__pstl/cpu_algos/find_if.h
deleted file mode 100644
index c7393c41c1f45..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/find_if.h
+++ /dev/null
@@ -1,137 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_FIND_IF_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_FIND_IF_H
-
-#include <__cxx03/__algorithm/find_if.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__atomic/atomic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Backend, class _Index, class _Brick, class _Compare>
-_LIBCPP_HIDE_FROM_ABI optional<_Index>
-__parallel_find(_Index __first, _Index __last, _Brick __f, _Compare __comp, bool __b_first) {
- typedef typename std::iterator_traits<_Index>::difference_type _DifferenceType;
- const _DifferenceType __n = __last - __first;
- _DifferenceType __initial_dist = __b_first ? __n : -1;
- std::atomic<_DifferenceType> __extremum(__initial_dist);
- // TODO: find out what is better here: parallel_for or parallel_reduce
- auto __res =
- __cpu_traits<_Backend>::__for_each(__first, __last, [__comp, __f, __first, &__extremum](_Index __i, _Index __j) {
- // See "Reducing Contention Through Priority Updates", PPoPP '13, for discussion of
- // why using a shared variable scales fairly well in this situation.
- if (__comp(__i - __first, __extremum)) {
- _Index __result = __f(__i, __j);
- // If not '__last' returned then we found what we want so put this to extremum
- if (__result != __j) {
- const _DifferenceType __k = __result - __first;
- for (_DifferenceType __old = __extremum; __comp(__k, __old); __old = __extremum) {
- __extremum.compare_exchange_weak(__old, __k);
- }
- }
- }
- });
- if (!__res)
- return nullopt;
- return __extremum.load() != __initial_dist ? __first + __extremum.load() : __last;
-}
-
-template <class _Backend, class _Index, class _DifferenceType, class _Compare>
-_LIBCPP_HIDE_FROM_ABI _Index
-__simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept {
- // Experiments show good block sizes like this
- const _DifferenceType __block_size = 8;
- alignas(__cpu_traits<_Backend>::__lane_size) _DifferenceType __lane[__block_size] = {0};
- while (__end - __begin >= __block_size) {
- _DifferenceType __found = 0;
- _PSTL_PRAGMA_SIMD_REDUCTION(| : __found) for (_DifferenceType __i = __begin; __i < __begin + __block_size; ++__i) {
- const _DifferenceType __t = __comp(__first, __i);
- __lane[__i - __begin] = __t;
- __found |= __t;
- }
- if (__found) {
- _DifferenceType __i;
- // This will vectorize
- for (__i = 0; __i < __block_size; ++__i) {
- if (__lane[__i]) {
- break;
- }
- }
- return __first + __begin + __i;
- }
- __begin += __block_size;
- }
-
- // Keep remainder scalar
- while (__begin != __end) {
- if (__comp(__first, __begin)) {
- return __first + __begin;
- }
- ++__begin;
- }
- return __first + __end;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_find_if {
- template <class _Policy, class _ForwardIterator, class _Predicate>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__parallel_find<_Backend>(
- __first,
- __last,
- [&__policy, &__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- using _FindIfUnseq = __pstl::__find_if<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- auto __res = _FindIfUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __pred);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- },
- less<>{},
- true);
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- using __diff_t = __iter_diff_t<_ForwardIterator>;
- return __pstl::__simd_first<_Backend>(
- __first, __diff_t(0), __last - __first, [&__pred](_ForwardIterator __iter, __diff_t __i) {
- return __pred(__iter[__i]);
- });
- } else {
- return std::find_if(__first, __last, __pred);
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_FIND_IF_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/for_each.h b/libcxx/include/__cxx03/__pstl/cpu_algos/for_each.h
deleted file mode 100644
index 9362f56b323b6..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/for_each.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_FOR_EACH_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_FOR_EACH_H
-
-#include <__cxx03/__algorithm/for_each.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Iterator, class _DifferenceType, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator __simd_for_each(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
- _PSTL_PRAGMA_SIMD
- for (_DifferenceType __i = 0; __i < __n; ++__i)
- __f(__first[__i]);
-
- return __first + __n;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_for_each {
- template <class _Policy, class _ForwardIterator, class _Function>
- _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __cpu_traits<_Backend>::__for_each(
- __first, __last, [&__policy, __func](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- using _ForEachUnseq = __pstl::__for_each<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- [[maybe_unused]] auto __res =
- _ForEachUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __func);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- __pstl::__simd_for_each(__first, __last - __first, __func);
- return __empty{};
- } else {
- std::for_each(__first, __last, __func);
- return __empty{};
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_FOR_EACH_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/merge.h b/libcxx/include/__cxx03/__pstl/cpu_algos/merge.h
deleted file mode 100644
index 9bab8b4838ef2..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/merge.h
+++ /dev/null
@@ -1,85 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_MERGE_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_MERGE_H
-
-#include <__cxx03/__algorithm/merge.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_merge {
- template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
- _Policy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __result,
- _Comp __comp) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- auto __res = __cpu_traits<_Backend>::__merge(
- __first1,
- __last1,
- __first2,
- __last2,
- __result,
- __comp,
- [&__policy](_ForwardIterator1 __g_first1,
- _ForwardIterator1 __g_last1,
- _ForwardIterator2 __g_first2,
- _ForwardIterator2 __g_last2,
- _ForwardOutIterator __g_result,
- _Comp __g_comp) {
- using _MergeUnseq = __pstl::__merge<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- [[maybe_unused]] auto __g_res = _MergeUnseq()(
- std::__remove_parallel_policy(__policy),
- std::move(__g_first1),
- std::move(__g_last1),
- std::move(__g_first2),
- std::move(__g_last2),
- std::move(__g_result),
- std::move(__g_comp));
- _LIBCPP_ASSERT_INTERNAL(__g_res, "unsed/sed should never try to allocate!");
- });
- if (!__res)
- return nullopt;
- return __result + (__last1 - __first1) + (__last2 - __first2);
- } else {
- return std::merge(__first1, __last1, __first2, __last2, __result, __comp);
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_MERGE_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/stable_sort.h b/libcxx/include/__cxx03/__pstl/cpu_algos/stable_sort.h
deleted file mode 100644
index c0ebb2cd0a1c7..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/stable_sort.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_STABLE_SORT_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_STABLE_SORT_H
-
-#include <__cxx03/__algorithm/stable_sort.h>
-#include <__cxx03/__config>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_stable_sort {
- template <class _Policy, class _RandomAccessIterator, class _Comp>
- _LIBCPP_HIDE_FROM_ABI optional<__empty>
- operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy>) {
- return __cpu_traits<_Backend>::__stable_sort(
- __first, __last, __comp, [](_RandomAccessIterator __g_first, _RandomAccessIterator __g_last, _Comp __g_comp) {
- std::stable_sort(__g_first, __g_last, __g_comp);
- });
- } else {
- std::stable_sort(__first, __last, __comp);
- return __empty{};
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_STABLE_SORT_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/transform.h b/libcxx/include/__cxx03/__pstl/cpu_algos/transform.h
deleted file mode 100644
index 500e110ac7e2e..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/transform.h
+++ /dev/null
@@ -1,153 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_H
-
-#include <__cxx03/__algorithm/transform.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator2
-__simd_transform(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
- _PSTL_PRAGMA_SIMD
- for (_DifferenceType __i = 0; __i < __n; ++__i)
- __f(__first1[__i], __first2[__i]);
- return __first2 + __n;
-}
-
-template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_transform(
- _Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
- _PSTL_PRAGMA_SIMD
- for (_DifferenceType __i = 0; __i < __n; ++__i)
- __f(__first1[__i], __first2[__i], __first3[__i]);
- return __first3 + __n;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_transform {
- template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- _UnaryOperation __op) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- __cpu_traits<_Backend>::__for_each(
- __first,
- __last,
- [&__policy, __op, __first, __result](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- using _TransformUnseq = __pstl::__transform<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- auto __res = _TransformUnseq()(
- std::__remove_parallel_policy(__policy),
- __brick_first,
- __brick_last,
- __result + (__brick_first - __first),
- __op);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- return __result + (__last - __first);
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- return __pstl::__simd_transform(
- __first,
- __last - __first,
- __result,
- [&](__iter_reference<_ForwardIterator> __in_value, __iter_reference<_ForwardOutIterator> __out_value) {
- __out_value = __op(__in_value);
- });
- } else {
- return std::transform(__first, __last, __result, __op);
- }
- }
-};
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_transform_binary {
- template <class _Policy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
- operator()(_Policy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardOutIterator __result,
- _BinaryOperation __op) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- auto __res = __cpu_traits<_Backend>::__for_each(
- __first1,
- __last1,
- [&__policy, __op, __first1, __first2, __result](
- _ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last) {
- using _TransformBinaryUnseq =
- __pstl::__transform_binary<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- return _TransformBinaryUnseq()(
- std::__remove_parallel_policy(__policy),
- __brick_first,
- __brick_last,
- __first2 + (__brick_first - __first1),
- __result + (__brick_first - __first1),
- __op);
- });
- if (!__res)
- return nullopt;
- return __result + (__last1 - __first1);
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- return __pstl::__simd_transform(
- __first1,
- __last1 - __first1,
- __first2,
- __result,
- [&](__iter_reference<_ForwardIterator1> __in1,
- __iter_reference<_ForwardIterator2> __in2,
- __iter_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in1, __in2); });
- } else {
- return std::transform(__first1, __last1, __first2, __result, __op);
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_H
diff --git a/libcxx/include/__cxx03/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__cxx03/__pstl/cpu_algos/transform_reduce.h
deleted file mode 100644
index 38764d963fc5e..0000000000000
--- a/libcxx/include/__cxx03/__pstl/cpu_algos/transform_reduce.h
+++ /dev/null
@@ -1,216 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
-#define _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__numeric/transform_reduce.h>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__pstl/cpu_algos/cpu_traits.h>
-#include <__cxx03/__type_traits/desugars_to.h>
-#include <__cxx03/__type_traits/is_arithmetic.h>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/new>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <typename _Backend,
- typename _DifferenceType,
- typename _Tp,
- typename _BinaryOperation,
- typename _UnaryOperation,
- typename _UnaryResult = invoke_result_t<_UnaryOperation, _DifferenceType>,
- __enable_if_t<__desugars_to_v<__plus_tag, _BinaryOperation, _Tp, _UnaryResult> && is_arithmetic_v<_Tp> &&
- is_arithmetic_v<_UnaryResult>,
- int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp
-__simd_transform_reduce(_DifferenceType __n, _Tp __init, _BinaryOperation, _UnaryOperation __f) noexcept {
- _PSTL_PRAGMA_SIMD_REDUCTION(+ : __init)
- for (_DifferenceType __i = 0; __i < __n; ++__i)
- __init += __f(__i);
- return __init;
-}
-
-template <typename _Backend,
- typename _Size,
- typename _Tp,
- typename _BinaryOperation,
- typename _UnaryOperation,
- typename _UnaryResult = invoke_result_t<_UnaryOperation, _Size>,
- __enable_if_t<!(__desugars_to_v<__plus_tag, _BinaryOperation, _Tp, _UnaryResult> && is_arithmetic_v<_Tp> &&
- is_arithmetic_v<_UnaryResult>),
- int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp
-__simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept {
- constexpr size_t __lane_size = __cpu_traits<_Backend>::__lane_size;
- const _Size __block_size = __lane_size / sizeof(_Tp);
- if (__n > 2 * __block_size && __block_size > 1) {
- alignas(__lane_size) char __lane_buffer[__lane_size];
- _Tp* __lane = reinterpret_cast<_Tp*>(__lane_buffer);
-
- // initializer
- _PSTL_PRAGMA_SIMD
- for (_Size __i = 0; __i < __block_size; ++__i) {
- ::new (__lane + __i) _Tp(__binary_op(__f(__i), __f(__block_size + __i)));
- }
- // main loop
- _Size __i = 2 * __block_size;
- const _Size __last_iteration = __block_size * (__n / __block_size);
- for (; __i < __last_iteration; __i += __block_size) {
- _PSTL_PRAGMA_SIMD
- for (_Size __j = 0; __j < __block_size; ++__j) {
- __lane[__j] = __binary_op(std::move(__lane[__j]), __f(__i + __j));
- }
- }
- // remainder
- _PSTL_PRAGMA_SIMD
- for (_Size __j = 0; __j < __n - __last_iteration; ++__j) {
- __lane[__j] = __binary_op(std::move(__lane[__j]), __f(__last_iteration + __j));
- }
- // combiner
- for (_Size __j = 0; __j < __block_size; ++__j) {
- __init = __binary_op(std::move(__init), std::move(__lane[__j]));
- }
- // destroyer
- _PSTL_PRAGMA_SIMD
- for (_Size __j = 0; __j < __block_size; ++__j) {
- __lane[__j].~_Tp();
- }
- } else {
- for (_Size __i = 0; __i < __n; ++__i) {
- __init = __binary_op(std::move(__init), __f(__i));
- }
- }
- return __init;
-}
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_transform_reduce_binary {
- template <class _Policy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2>
- _LIBCPP_HIDE_FROM_ABI optional<_Tp> operator()(
- _Policy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Tp __init,
- _BinaryOperation1 __reduce,
- _BinaryOperation2 __transform) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
- return __cpu_traits<_Backend>::__transform_reduce(
- __first1,
- std::move(__last1),
- [__first1, __first2, __transform](_ForwardIterator1 __iter) {
- return __transform(*__iter, *(__first2 + (__iter - __first1)));
- },
- std::move(__init),
- std::move(__reduce),
- [&__policy, __first1, __first2, __reduce, __transform](
- _ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last, _Tp __brick_init) {
- using _TransformReduceBinaryUnseq =
- __pstl::__transform_reduce_binary<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- return *_TransformReduceBinaryUnseq()(
- std::__remove_parallel_policy(__policy),
- __brick_first,
- std::move(__brick_last),
- __first2 + (__brick_first - __first1),
- std::move(__brick_init),
- std::move(__reduce),
- std::move(__transform));
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
- return __pstl::__simd_transform_reduce<_Backend>(
- __last1 - __first1, std::move(__init), std::move(__reduce), [&](__iter_diff_t<_ForwardIterator1> __i) {
- return __transform(__first1[__i], __first2[__i]);
- });
- } else {
- return std::transform_reduce(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__init),
- std::move(__reduce),
- std::move(__transform));
- }
- }
-};
-
-template <class _Backend, class _RawExecutionPolicy>
-struct __cpu_parallel_transform_reduce {
- template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
- _LIBCPP_HIDE_FROM_ABI optional<_Tp>
- operator()(_Policy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Tp __init,
- _BinaryOperation __reduce,
- _UnaryOperation __transform) const noexcept {
- if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __cpu_traits<_Backend>::__transform_reduce(
- std::move(__first),
- std::move(__last),
- [__transform](_ForwardIterator __iter) { return __transform(*__iter); },
- std::move(__init),
- __reduce,
- [&__policy, __transform, __reduce](auto __brick_first, auto __brick_last, _Tp __brick_init) {
- using _TransformReduceUnseq =
- __pstl::__transform_reduce<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
- auto __res = _TransformReduceUnseq()(
- std::__remove_parallel_policy(__policy),
- std::move(__brick_first),
- std::move(__brick_last),
- std::move(__brick_init),
- std::move(__reduce),
- std::move(__transform));
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__simd_transform_reduce<_Backend>(
- __last - __first,
- std::move(__init),
- std::move(__reduce),
- [=, &__transform](__iter_diff_t<_ForwardIterator> __i) { return __transform(__first[__i]); });
- } else {
- return std::transform_reduce(
- std::move(__first), std::move(__last), std::move(__init), std::move(__reduce), std::move(__transform));
- }
- }
-};
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
diff --git a/libcxx/include/__cxx03/__pstl/dispatch.h b/libcxx/include/__cxx03/__pstl/dispatch.h
deleted file mode 100644
index 39857d0eafd63..0000000000000
--- a/libcxx/include/__cxx03/__pstl/dispatch.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_DISPATCH_H
-#define _LIBCPP___CXX03___PSTL_DISPATCH_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__pstl/backend_fwd.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/type_identity.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <template <class, class> class _Algorithm, class _Backend, class _ExecutionPolicy, class = void>
-constexpr bool __is_implemented_v = false;
-
-template <template <class, class> class _Algorithm, class _Backend, class _ExecutionPolicy>
-constexpr bool __is_implemented_v<_Algorithm,
- _Backend,
- _ExecutionPolicy,
- __enable_if_t<sizeof(_Algorithm<_Backend, _ExecutionPolicy>)>> = true;
-
-// Helpful to provide better error messages. This will show the algorithm and the execution policy
-// in the compiler diagnostic.
-template <template <class, class> class _Algorithm, class _ExecutionPolicy>
-constexpr bool __cant_find_backend_for = false;
-
-template <template <class, class> class _Algorithm, class _BackendConfiguration, class _ExecutionPolicy>
-struct __find_first_implemented;
-
-template <template <class, class> class _Algorithm, class _ExecutionPolicy>
-struct __find_first_implemented<_Algorithm, __backend_configuration<>, _ExecutionPolicy> {
- static_assert(__cant_find_backend_for<_Algorithm, _ExecutionPolicy>,
- "Could not find a PSTL backend for the given algorithm and execution policy");
-};
-
-template <template <class, class> class _Algorithm, class _B1, class... _Bn, class _ExecutionPolicy>
-struct __find_first_implemented<_Algorithm, __backend_configuration<_B1, _Bn...>, _ExecutionPolicy>
- : _If<__is_implemented_v<_Algorithm, _B1, _ExecutionPolicy>,
- __type_identity<_Algorithm<_B1, _ExecutionPolicy>>,
- __find_first_implemented<_Algorithm, __backend_configuration<_Bn...>, _ExecutionPolicy> > {};
-
-template <template <class, class> class _Algorithm, class _BackendConfiguration, class _ExecutionPolicy>
-using __dispatch = typename __find_first_implemented<_Algorithm, _BackendConfiguration, _ExecutionPolicy>::type;
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_DISPATCH_H
diff --git a/libcxx/include/__cxx03/__pstl/handle_exception.h b/libcxx/include/__cxx03/__pstl/handle_exception.h
deleted file mode 100644
index e21146fa1eaca..0000000000000
--- a/libcxx/include/__cxx03/__pstl/handle_exception.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___PSTL_HANDLE_EXCEPTION_H
-#define _LIBCPP___CXX03___PSTL_HANDLE_EXCEPTION_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/new> // __throw_bad_alloc
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-namespace __pstl {
-
-template <class _BackendFunction, class... _Args>
-_LIBCPP_HIDE_FROM_ABI auto __handle_exception_impl(_Args&&... __args) noexcept {
- return _BackendFunction{}(std::forward<_Args>(__args)...);
-}
-
-// This function is used to call a backend PSTL algorithm from a frontend algorithm.
-//
-// All PSTL backend algorithms return an optional denoting whether there was an
-// "infrastructure"-level failure (aka failure to allocate). This function takes
-// care of unwrapping that and throwing `bad_alloc()` in case there was a problem
-// in the underlying implementation.
-//
-// We must also be careful not to call any user code that could throw an exception
-// (such as moving or copying iterators) in here since that should terminate the
-// program, which is why we delegate to a noexcept helper below.
-template <class _BackendFunction, class... _Args>
-_LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) {
- auto __result = __pstl::__handle_exception_impl<_BackendFunction>(std::forward<_Args>(__args)...);
- if (__result == nullopt)
- std::__throw_bad_alloc();
- else
- return std::move(*__result);
-}
-
-} // namespace __pstl
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___PSTL_HANDLE_EXCEPTION_H
diff --git a/libcxx/include/__cxx03/__random/generate_canonical.h b/libcxx/include/__cxx03/__random/generate_canonical.h
index deea98fd0314b..f2e353ae028f8 100644
--- a/libcxx/include/__cxx03/__random/generate_canonical.h
+++ b/libcxx/include/__cxx03/__random/generate_canonical.h
@@ -12,7 +12,6 @@
#include <__cxx03/__config>
#include <__cxx03/__random/log2.h>
#include <__cxx03/cstdint>
-#include <__cxx03/initializer_list>
#include <__cxx03/limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__random/seed_seq.h b/libcxx/include/__cxx03/__random/seed_seq.h
index 617ee66c819d8..67cc843e63076 100644
--- a/libcxx/include/__cxx03/__random/seed_seq.h
+++ b/libcxx/include/__cxx03/__random/seed_seq.h
@@ -16,7 +16,6 @@
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__type_traits/is_unsigned.h>
#include <__cxx03/cstdint>
-#include <__cxx03/initializer_list>
#include <__cxx03/vector>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__random/uniform_random_bit_generator.h b/libcxx/include/__cxx03/__random/uniform_random_bit_generator.h
deleted file mode 100644
index 37c10a1ddfbd9..0000000000000
--- a/libcxx/include/__cxx03/__random/uniform_random_bit_generator.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H
-#define _LIBCPP___CXX03___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [rand.req.urng]
-template <class _Gen>
-concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires {
- { _Gen::min() } -> same_as<invoke_result_t<_Gen&>>;
- { _Gen::max() } -> same_as<invoke_result_t<_Gen&>>;
- requires bool_constant<(_Gen::min() < _Gen::max())>::value;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H
diff --git a/libcxx/include/__cxx03/__ranges/access.h b/libcxx/include/__cxx03/__ranges/access.h
deleted file mode 100644
index 23b61946a16bb..0000000000000
--- a/libcxx/include/__cxx03/__ranges/access.h
+++ /dev/null
@@ -1,210 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ACCESS_H
-#define _LIBCPP___CXX03___RANGES_ACCESS_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/auto_cast.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _Tp>
-concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
-} // namespace ranges
-
-// [range.access.begin]
-
-namespace ranges {
-namespace __begin {
-template <class _Tp>
-concept __member_begin = __can_borrow<_Tp> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
-};
-
-void begin() = delete;
-
-template <class _Tp>
-concept __unqualified_begin =
- !__member_begin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(begin(__t)) } -> input_or_output_iterator;
- };
-
-struct __fn {
- template <class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[]) const noexcept
- requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + 0;
- }
-
- template <class _Tp>
- requires __member_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) {
- return _LIBCPP_AUTO_CAST(__t.begin());
- }
-
- template <class _Tp>
- requires __unqualified_begin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) {
- return _LIBCPP_AUTO_CAST(begin(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __begin
-
-inline namespace __cpo {
-inline constexpr auto begin = __begin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.range]
-
-namespace ranges {
-template <class _Tp>
-using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
-} // namespace ranges
-
-// [range.access.end]
-
-namespace ranges {
-namespace __end {
-template <class _Tp>
-concept __member_end = __can_borrow<_Tp> && requires(_Tp&& __t) {
- typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
-};
-
-void end() = delete;
-
-template <class _Tp>
-concept __unqualified_end =
- !__member_end<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- typename iterator_t<_Tp>;
- { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>;
- };
-
-struct __fn {
- template <class _Tp, size_t _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept
- requires(sizeof(_Tp) >= 0) // Disallow incomplete element types.
- {
- return __t + _Np;
- }
-
- template <class _Tp>
- requires __member_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) {
- return _LIBCPP_AUTO_CAST(__t.end());
- }
-
- template <class _Tp>
- requires __unqualified_end<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) {
- return _LIBCPP_AUTO_CAST(end(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __end
-
-inline namespace __cpo {
-inline constexpr auto end = __end::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.cbegin]
-
-namespace ranges {
-namespace __cbegin {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype(ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
- return ranges::begin(static_cast<const remove_reference_t<_Tp>&>(__t));
- }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(static_cast<const _Tp&&>(__t))))
- -> decltype(ranges::begin(static_cast<const _Tp&&>(__t))) {
- return ranges::begin(static_cast<const _Tp&&>(__t));
- }
-};
-} // namespace __cbegin
-
-inline namespace __cpo {
-inline constexpr auto cbegin = __cbegin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.cend]
-
-namespace ranges {
-namespace __cend {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype(ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t))) {
- return ranges::end(static_cast<const remove_reference_t<_Tp>&>(__t));
- }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
- noexcept(ranges::end(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::end(static_cast<const _Tp&&>(__t))) {
- return ranges::end(static_cast<const _Tp&&>(__t));
- }
-};
-} // namespace __cend
-
-inline namespace __cpo {
-inline constexpr auto cend = __cend::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_ACCESS_H
diff --git a/libcxx/include/__cxx03/__ranges/all.h b/libcxx/include/__cxx03/__ranges/all.h
deleted file mode 100644
index 57497f83478b5..0000000000000
--- a/libcxx/include/__cxx03/__ranges/all.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ALL_H
-#define _LIBCPP___CXX03___RANGES_ALL_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/compose.h> // TODO(modules): Those should not be required
-#include <__cxx03/__functional/perfect_forward.h> //
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/owning_view.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/ref_view.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/auto_cast.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges::views {
-
-namespace __all {
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Tp>
- requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
- noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
- return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
- }
-
- template <class _Tp>
- requires(!ranges::view<decay_t<_Tp>>) && requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::ref_view{std::forward<_Tp>(__t)})) {
- return ranges::ref_view{std::forward<_Tp>(__t)};
- }
-
- template <class _Tp>
- requires(
- !ranges::view<decay_t<_Tp>> && !requires(_Tp&& __t) { ranges::ref_view{std::forward<_Tp>(__t)}; } &&
- requires(_Tp&& __t) { ranges::owning_view{std::forward<_Tp>(__t)}; })
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::owning_view{std::forward<_Tp>(__t)})) {
- return ranges::owning_view{std::forward<_Tp>(__t)};
- }
-};
-} // namespace __all
-
-inline namespace __cpo {
-inline constexpr auto all = __all::__fn{};
-} // namespace __cpo
-
-template <ranges::viewable_range _Range>
-using all_t = decltype(views::all(std::declval<_Range>()));
-
-} // namespace ranges::views
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_ALL_H
diff --git a/libcxx/include/__cxx03/__ranges/as_rvalue_view.h b/libcxx/include/__cxx03/__ranges/as_rvalue_view.h
deleted file mode 100644
index 42234dabaf081..0000000000000
--- a/libcxx/include/__cxx03/__ranges/as_rvalue_view.h
+++ /dev/null
@@ -1,142 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___RANGES_AS_RVALUE_H
-#define _LIBCPP___CXX03___RANGES_AS_RVALUE_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/move_iterator.h>
-#include <__cxx03/__iterator/move_sentinel.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-template <view _View>
- requires input_range<_View>
-class as_rvalue_view : public view_interface<as_rvalue_view<_View>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI as_rvalue_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit as_rvalue_view(_View __base) : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!__simple_view<_View>)
- {
- return move_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _View>
- {
- return move_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View>)
- {
- if constexpr (common_range<_View>) {
- return move_iterator(ranges::end(__base_));
- } else {
- return move_sentinel(ranges::end(__base_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View>
- {
- if constexpr (common_range<const _View>) {
- return move_iterator(ranges::end(__base_));
- } else {
- return move_sentinel(ranges::end(__base_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return ranges::size(__base_);
- }
-};
-
-template <class _Range>
-as_rvalue_view(_Range&&) -> as_rvalue_view<views::all_t<_Range>>;
-
-template <class _View>
-inline constexpr bool enable_borrowed_range<as_rvalue_view<_View>> = enable_borrowed_range<_View>;
-
-namespace views {
-namespace __as_rvalue {
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
- operator()(_Range&& __range) noexcept(noexcept(as_rvalue_view(std::forward<_Range>(__range))))
- -> decltype(/*--------------------------*/ as_rvalue_view(std::forward<_Range>(__range))) {
- return /*---------------------------------*/ as_rvalue_view(std::forward<_Range>(__range));
- }
-
- template <class _Range>
- requires same_as<range_rvalue_reference_t<_Range>, range_reference_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
- operator()(_Range&& __range) noexcept(noexcept(views::all(std::forward<_Range>(__range))))
- -> decltype(/*--------------------------*/ views::all(std::forward<_Range>(__range))) {
- return /*---------------------------------*/ views::all(std::forward<_Range>(__range));
- }
-};
-} // namespace __as_rvalue
-
-inline namespace __cpo {
-inline constexpr auto as_rvalue = __as_rvalue::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_AS_RVALUE_H
diff --git a/libcxx/include/__cxx03/__ranges/chunk_by_view.h b/libcxx/include/__cxx03/__ranges/chunk_by_view.h
deleted file mode 100644
index 2b5c4d607c417..0000000000000
--- a/libcxx/include/__cxx03/__ranges/chunk_by_view.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_CHUNK_BY_VIEW_H
-#define _LIBCPP___CXX03___RANGES_CHUNK_BY_VIEW_H
-
-#include <__cxx03/__algorithm/ranges_adjacent_find.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/prev.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/reverse_view.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace ranges {
-
-template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
- // We cache the result of begin() to allow providing an amortized O(1).
- using _Cache = __non_propagating_cache<iterator_t<_View>>;
- _Cache __cached_begin_;
-
- class __iterator;
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_next(iterator_t<_View> __current) {
- // Note: this duplicates a check in `optional` but provides a better error message.
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __pred_.__has_value(), "Trying to call __find_next() on a chunk_by_view that does not have a valid predicate.");
- auto __reversed_pred = [this]<class _Tp, class _Up>(_Tp&& __x, _Up&& __y) -> bool {
- return !std::invoke(*__pred_, std::forward<_Tp>(__x), std::forward<_Up>(__y));
- };
- return ranges::next(
- ranges::adjacent_find(__current, ranges::end(__base_), __reversed_pred), 1, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> __find_prev(iterator_t<_View> __current)
- requires bidirectional_range<_View>
- {
- // Attempting to decrement a begin iterator is a no-op (`__find_prev` would return the same argument given to it).
- _LIBCPP_ASSERT_PEDANTIC(__current != ranges::begin(__base_), "Trying to call __find_prev() on a begin iterator.");
- // Note: this duplicates a check in `optional` but provides a better error message.
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __pred_.__has_value(), "Trying to call __find_prev() on a chunk_by_view that does not have a valid predicate.");
-
- auto __first = ranges::begin(__base_);
- reverse_view __reversed{subrange{__first, __current}};
- auto __reversed_pred = [this]<class _Tp, class _Up>(_Tp&& __x, _Up&& __y) -> bool {
- return !std::invoke(*__pred_, std::forward<_Up>(__y), std::forward<_Tp>(__x));
- };
- return ranges::prev(ranges::adjacent_find(__reversed, __reversed_pred).base(), 1, std::move(__first));
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI chunk_by_view()
- requires default_initializable<_View> && default_initializable<_Pred>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit chunk_by_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
- // Note: this duplicates a check in `optional` but provides a better error message.
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __pred_.__has_value(), "Trying to call begin() on a chunk_by_view that does not have a valid predicate.");
-
- auto __first = ranges::begin(__base_);
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(__find_next(__first));
- }
- return {*this, std::move(__first), *__cached_begin_};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
- if constexpr (common_range<_View>) {
- return __iterator{*this, ranges::end(__base_), ranges::end(__base_)};
- } else {
- return default_sentinel;
- }
- }
-};
-
-template <class _Range, class _Pred>
-chunk_by_view(_Range&&, _Pred) -> chunk_by_view<views::all_t<_Range>, _Pred>;
-
-template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
-class chunk_by_view<_View, _Pred>::__iterator {
- friend chunk_by_view;
-
- chunk_by_view* __parent_ = nullptr;
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __next_ = iterator_t<_View>();
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(
- chunk_by_view& __parent, iterator_t<_View> __current, iterator_t<_View> __next)
- : __parent_(std::addressof(__parent)), __current_(__current), __next_(__next) {}
-
-public:
- using value_type = subrange<iterator_t<_View>>;
- using difference_type = range_difference_t<_View>;
- using iterator_category = input_iterator_tag;
- using iterator_concept = conditional_t<bidirectional_range<_View>, bidirectional_iterator_tag, forward_iterator_tag>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const {
- // If the iterator is at end, this would return an empty range which can be checked by the calling code and doesn't
- // necessarily lead to a bad access.
- _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to dereference past-the-end chunk_by_view iterator.");
- return {__current_, __next_};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- // Attempting to increment an end iterator is a no-op (`__find_next` would return the same argument given to it).
- _LIBCPP_ASSERT_PEDANTIC(__current_ != __next_, "Trying to increment past end chunk_by_view iterator.");
- __current_ = __next_;
- __next_ = __parent_->__find_next(__current_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires bidirectional_range<_View>
- {
- __next_ = __current_;
- __current_ = __parent_->__find_prev(__next_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires bidirectional_range<_View>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, default_sentinel_t) {
- return __x.__current_ == __x.__next_;
- }
-};
-
-namespace views {
-namespace __chunk_by {
-struct __fn {
- template <class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
- noexcept(noexcept(/**/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype(/*--*/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
- return /*-------------*/ chunk_by_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
- }
-
- template <class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
- }
-};
-} // namespace __chunk_by
-
-inline namespace __cpo {
-inline constexpr auto chunk_by = __chunk_by::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_CHUNK_BY_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/common_view.h b/libcxx/include/__cxx03/__ranges/common_view.h
deleted file mode 100644
index e7022ff63abba..0000000000000
--- a/libcxx/include/__cxx03/__ranges/common_view.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_COMMON_VIEW_H
-#define _LIBCPP___CXX03___RANGES_COMMON_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/common_iterator.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <view _View>
- requires(!common_range<_View> && copyable<iterator_t<_View>>)
-class common_view : public view_interface<common_view<_View>> {
- _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI common_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit common_view(_View __v) : __base_(std::move(__v)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
- if constexpr (random_access_range<_View> && sized_range<_View>)
- return ranges::begin(__base_);
- else
- return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _View>
- {
- if constexpr (random_access_range<const _View> && sized_range<const _View>)
- return ranges::begin(__base_);
- else
- return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
- if constexpr (random_access_range<_View> && sized_range<_View>)
- return ranges::begin(__base_) + ranges::size(__base_);
- else
- return common_iterator<iterator_t<_View>, sentinel_t<_View>>(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View>
- {
- if constexpr (random_access_range<const _View> && sized_range<const _View>)
- return ranges::begin(__base_) + ranges::size(__base_);
- else
- return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return ranges::size(__base_);
- }
-};
-
-template <class _Range>
-common_view(_Range&&) -> common_view<views::all_t<_Range>>;
-
-template <class _View>
-inline constexpr bool enable_borrowed_range<common_view<_View>> = enable_borrowed_range<_View>;
-
-namespace views {
-namespace __common {
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Range>
- requires common_range<_Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(
- noexcept(views::all(std::forward<_Range>(__range)))) -> decltype(views::all(std::forward<_Range>(__range))) {
- return views::all(std::forward<_Range>(__range));
- }
-
- template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(common_view{
- std::forward<_Range>(__range)})) -> decltype(common_view{std::forward<_Range>(__range)}) {
- return common_view{std::forward<_Range>(__range)};
- }
-};
-} // namespace __common
-
-inline namespace __cpo {
-inline constexpr auto common = __common::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_COMMON_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/concepts.h b/libcxx/include/__cxx03/__ranges/concepts.h
deleted file mode 100644
index 958a81c19bfa7..0000000000000
--- a/libcxx/include/__cxx03/__ranges/concepts.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_CONCEPTS_H
-#define _LIBCPP___CXX03___RANGES_CONCEPTS_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/enable_view.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-// [range.range]
-
-template <class _Tp>
-concept range = requires(_Tp& __t) {
- ranges::begin(__t); // sometimes equality-preserving
- ranges::end(__t);
-};
-
-template <class _Tp>
-concept input_range = range<_Tp> && input_iterator<iterator_t<_Tp>>;
-
-template <class _Range>
-concept borrowed_range =
- range<_Range> && (is_lvalue_reference_v<_Range> || enable_borrowed_range<remove_cvref_t<_Range>>);
-
-// `iterator_t` defined in <__ranges/access.h>
-
-template <range _Rp>
-using sentinel_t = decltype(ranges::end(std::declval<_Rp&>()));
-
-template <range _Rp>
-using range_difference_t = iter_difference_t<iterator_t<_Rp>>;
-
-template <range _Rp>
-using range_value_t = iter_value_t<iterator_t<_Rp>>;
-
-template <range _Rp>
-using range_reference_t = iter_reference_t<iterator_t<_Rp>>;
-
-template <range _Rp>
-using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>;
-
-template <range _Rp>
-using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>;
-
-// [range.sized]
-template <class _Tp>
-concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); };
-
-template <sized_range _Rp>
-using range_size_t = decltype(ranges::size(std::declval<_Rp&>()));
-
-// `disable_sized_range` defined in `<__ranges/size.h>`
-
-// [range.view], views
-
-// `enable_view` defined in <__ranges/enable_view.h>
-// `view_base` defined in <__ranges/enable_view.h>
-
-template <class _Tp>
-concept view = range<_Tp> && movable<_Tp> && enable_view<_Tp>;
-
-template <class _Range>
-concept __simple_view =
- view<_Range> && range<const _Range> && same_as<iterator_t<_Range>, iterator_t<const _Range>> &&
- same_as<sentinel_t<_Range>, sentinel_t<const _Range>>;
-
-// [range.refinements], other range refinements
-template <class _Rp, class _Tp>
-concept output_range = range<_Rp> && output_iterator<iterator_t<_Rp>, _Tp>;
-
-template <class _Tp>
-concept forward_range = input_range<_Tp> && forward_iterator<iterator_t<_Tp>>;
-
-template <class _Tp>
-concept bidirectional_range = forward_range<_Tp> && bidirectional_iterator<iterator_t<_Tp>>;
-
-template <class _Tp>
-concept random_access_range = bidirectional_range<_Tp> && random_access_iterator<iterator_t<_Tp>>;
-
-template <class _Tp>
-concept contiguous_range = random_access_range<_Tp> && contiguous_iterator<iterator_t<_Tp>> && requires(_Tp& __t) {
- { ranges::data(__t) } -> same_as<add_pointer_t<range_reference_t<_Tp>>>;
-};
-
-template <class _Tp>
-concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>;
-
-template <class _Tp>
-inline constexpr bool __is_std_initializer_list = false;
-
-template <class _Ep>
-inline constexpr bool __is_std_initializer_list<initializer_list<_Ep>> = true;
-
-template <class _Tp>
-concept viewable_range =
- range<_Tp> &&
- ((view<remove_cvref_t<_Tp>> && constructible_from<remove_cvref_t<_Tp>, _Tp>) ||
- (!view<remove_cvref_t<_Tp>> &&
- (is_lvalue_reference_v<_Tp> ||
- (movable<remove_reference_t<_Tp>> && !__is_std_initializer_list<remove_cvref_t<_Tp>>))));
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_CONCEPTS_H
diff --git a/libcxx/include/__cxx03/__ranges/container_compatible_range.h b/libcxx/include/__cxx03/__ranges/container_compatible_range.h
deleted file mode 100644
index 9e47449fe50ab..0000000000000
--- a/libcxx/include/__cxx03/__ranges/container_compatible_range.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_CONTAINER_COMPATIBLE_RANGE_H
-#define _LIBCPP___CXX03___RANGES_CONTAINER_COMPATIBLE_RANGE_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__ranges/concepts.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Range, class _Tp>
-concept _ContainerCompatibleRange =
- ranges::input_range<_Range> && convertible_to<ranges::range_reference_t<_Range>, _Tp>;
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_CONTAINER_COMPATIBLE_RANGE_H
diff --git a/libcxx/include/__cxx03/__ranges/counted.h b/libcxx/include/__cxx03/__ranges/counted.h
deleted file mode 100644
index a4a11cd0064b9..0000000000000
--- a/libcxx/include/__cxx03/__ranges/counted.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_COUNTED_H
-#define _LIBCPP___CXX03___RANGES_COUNTED_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/counted_iterator.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/span>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges::views {
-
-namespace __counted {
-
-struct __fn {
- template <contiguous_iterator _It>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_It __it,
- iter_difference_t<_It> __count) noexcept(noexcept(span(std::to_address(__it), static_cast<size_t>(__count))))
- // Deliberately omit return-type SFINAE, because to_address is not SFINAE-friendly
- {
- return span(std::to_address(__it), static_cast<size_t>(__count));
- }
-
- template <random_access_iterator _It>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
- noexcept(subrange(__it, __it + __count))) -> decltype(subrange(__it, __it + __count)) {
- return subrange(__it, __it + __count);
- }
-
- template <class _It>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
- noexcept(subrange(counted_iterator(std::move(__it), __count), default_sentinel)))
- -> decltype(subrange(counted_iterator(std::move(__it), __count), default_sentinel)) {
- return subrange(counted_iterator(std::move(__it), __count), default_sentinel);
- }
-
- template <class _It, convertible_to<iter_difference_t<_It>> _Diff>
- requires input_or_output_iterator<decay_t<_It>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_It&& __it, _Diff&& __count) const
- noexcept(noexcept(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))))
- -> decltype(__go(std::forward<_It>(__it), std::forward<_Diff>(__count))) {
- return __go(std::forward<_It>(__it), std::forward<_Diff>(__count));
- }
-};
-
-} // namespace __counted
-
-inline namespace __cpo {
-inline constexpr auto counted = __counted::__fn{};
-} // namespace __cpo
-
-} // namespace ranges::views
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_COUNTED_H
diff --git a/libcxx/include/__cxx03/__ranges/dangling.h b/libcxx/include/__cxx03/__ranges/dangling.h
deleted file mode 100644
index d57eca19b1c30..0000000000000
--- a/libcxx/include/__cxx03/__ranges/dangling.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_DANGLING_H
-#define _LIBCPP___CXX03___RANGES_DANGLING_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/conditional.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-struct dangling {
- dangling() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr dangling(auto&&...) noexcept {}
-};
-
-template <range _Rp>
-using borrowed_iterator_t = _If<borrowed_range<_Rp>, iterator_t<_Rp>, dangling>;
-
-// borrowed_subrange_t defined in <__ranges/subrange.h>
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_DANGLING_H
diff --git a/libcxx/include/__cxx03/__ranges/data.h b/libcxx/include/__cxx03/__ranges/data.h
deleted file mode 100644
index 80e473d218614..0000000000000
--- a/libcxx/include/__cxx03/__ranges/data.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_DATA_H
-#define _LIBCPP___CXX03___RANGES_DATA_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/auto_cast.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [range.prim.data]
-
-namespace ranges {
-namespace __data {
-template <class _Tp>
-concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
-
-template <class _Tp>
-concept __member_data = __can_borrow<_Tp> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
-};
-
-template <class _Tp>
-concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && requires(_Tp&& __t) {
- { ranges::begin(__t) } -> contiguous_iterator;
-};
-
-struct __fn {
- template <__member_data _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
- return __t.data();
- }
-
- template <__ranges_begin_invocable _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
- return std::to_address(ranges::begin(__t));
- }
-};
-} // namespace __data
-
-inline namespace __cpo {
-inline constexpr auto data = __data::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.prim.cdata]
-
-namespace ranges {
-namespace __cdata {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) {
- return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t));
- }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
- noexcept(ranges::data(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
- return ranges::data(static_cast<const _Tp&&>(__t));
- }
-};
-} // namespace __cdata
-
-inline namespace __cpo {
-inline constexpr auto cdata = __cdata::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_DATA_H
diff --git a/libcxx/include/__cxx03/__ranges/drop_view.h b/libcxx/include/__cxx03/__ranges/drop_view.h
deleted file mode 100644
index 78e0a26e4c7e9..0000000000000
--- a/libcxx/include/__cxx03/__ranges/drop_view.h
+++ /dev/null
@@ -1,329 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_DROP_VIEW_H
-#define _LIBCPP___CXX03___RANGES_DROP_VIEW_H
-
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__fwd/span.h>
-#include <__cxx03/__fwd/string_view.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty_view.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/iota_view.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/repeat_view.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/auto_cast.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <view _View>
-class drop_view : public view_interface<drop_view<_View>> {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method. If this is an input_range, then we cannot cache
- // begin because begin is not equality preserving.
- // Note: drop_view<input-range>::begin() is still trivially amortized O(1) because
- // one can't call begin() on it more than once.
- static constexpr bool _UseCache = forward_range<_View> && !(random_access_range<_View> && sized_range<_View>);
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- range_difference_t<_View> __count_ = 0;
- _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI drop_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
- drop_view(_View __base, range_difference_t<_View> __count)
- : __count_(__count), __base_(std::move(__base)) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!(__simple_view<_View> && random_access_range<const _View> && sized_range<const _View>))
- {
- if constexpr (random_access_range<_View> && sized_range<_View>) {
- const auto __dist = std::min(ranges::distance(__base_), __count_);
- return ranges::begin(__base_) + __dist;
- }
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = ranges::next(ranges::begin(__base_), __count_, ranges::end(__base_));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires random_access_range<const _View> && sized_range<const _View>
- {
- const auto __dist = std::min(ranges::distance(__base_), __count_);
- return ranges::begin(__base_) + __dist;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View>)
- {
- return ranges::end(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View>
- {
- return ranges::end(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __size(auto& __self) {
- const auto __s = ranges::size(__self.__base_);
- const auto __c = static_cast<decltype(__s)>(__self.__count_);
- return __s < __c ? 0 : __s - __c;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return __size(*this);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return __size(*this);
- }
-};
-
-template <class _Range>
-drop_view(_Range&&, range_difference_t<_Range>) -> drop_view<views::all_t<_Range>>;
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<drop_view<_Tp>> = enable_borrowed_range<_Tp>;
-
-namespace views {
-namespace __drop {
-
-template <class _Tp>
-inline constexpr bool __is_empty_view = false;
-
-template <class _Tp>
-inline constexpr bool __is_empty_view<empty_view<_Tp>> = true;
-
-template <class _Tp>
-inline constexpr bool __is_passthrough_specialization = false;
-
-template <class _Tp, size_t _Extent>
-inline constexpr bool __is_passthrough_specialization<span<_Tp, _Extent>> = true;
-
-template <class _CharT, class _Traits>
-inline constexpr bool __is_passthrough_specialization<basic_string_view<_CharT, _Traits>> = true;
-
-template <class _Np, class _Bound>
-inline constexpr bool __is_passthrough_specialization<iota_view<_Np, _Bound>> = true;
-
-template <class _Iter, class _Sent, subrange_kind _Kind>
-inline constexpr bool __is_passthrough_specialization<subrange<_Iter, _Sent, _Kind>> =
- !subrange<_Iter, _Sent, _Kind>::_StoreSize;
-
-template <class _Tp>
-inline constexpr bool __is_subrange_specialization_with_store_size = false;
-
-template <class _Iter, class _Sent, subrange_kind _Kind>
-inline constexpr bool __is_subrange_specialization_with_store_size<subrange<_Iter, _Sent, _Kind>> =
- subrange<_Iter, _Sent, _Kind>::_StoreSize;
-
-template <class _Tp>
-struct __passthrough_type;
-
-template <class _Tp, size_t _Extent>
-struct __passthrough_type<span<_Tp, _Extent>> {
- using type = span<_Tp>;
-};
-
-template <class _CharT, class _Traits>
-struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
- using type = basic_string_view<_CharT, _Traits>;
-};
-
-template <class _Np, class _Bound>
-struct __passthrough_type<iota_view<_Np, _Bound>> {
- using type = iota_view<_Np, _Bound>;
-};
-
-template <class _Iter, class _Sent, subrange_kind _Kind>
-struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
- using type = subrange<_Iter, _Sent, _Kind>;
-};
-
-template <class _Tp>
-using __passthrough_type_t = typename __passthrough_type<_Tp>::type;
-
-struct __fn {
- // [range.drop.overview]: the `empty_view` case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
- requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
- return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
- }
-
- // [range.drop.overview]: the `span | basic_string_view | iota_view | subrange (StoreSize == false)` case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng))))
- -> decltype(__passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng))) {
- return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)), ranges::end(__rng));
- }
-
- // [range.drop.overview]: the `subrange (StoreSize == true)` case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
- __is_subrange_specialization_with_store_size<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(
- _RawRange(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))))
- -> decltype(_RawRange(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)),
- ranges::end(__rng),
- std::__to_unsigned_like(ranges::distance(__rng) -
- std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n))))) {
- // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the
- // expression used in the `noexcept` clause and the return statement).
- auto __dist = ranges::distance(__rng);
- auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n));
- return _RawRange(ranges::begin(__rng) + __clamped, ranges::end(__rng), std::__to_unsigned_like(__dist - __clamped));
- }
- // clang-format off
-#if _LIBCPP_STD_VER >= 23
- // [range.drop.overview]: the `repeat_view` "_RawRange models sized_range" case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (__is_repeat_specialization<_RawRange> && sized_range<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n)))))
- -> decltype( views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))))
- { return views::repeat(*__range.__value_, ranges::distance(__range) - std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))); }
-
- // [range.drop.overview]: the `repeat_view` "otherwise" case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (__is_repeat_specialization<_RawRange> && !sized_range<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype( _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)))
- { return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range)); }
-#endif
- // clang-format on
-
- // [range.drop.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires(!(__is_empty_view<_RawRange> ||
-# if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-# endif
- (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> &&
- random_access_range<_RawRange>)))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
- return drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
- }
-
- template <class _Np>
- requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
- }
-};
-
-} // namespace __drop
-
-inline namespace __cpo {
-inline constexpr auto drop = __drop::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_DROP_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/drop_while_view.h b/libcxx/include/__cxx03/__ranges/drop_while_view.h
deleted file mode 100644
index 604dd29742a90..0000000000000
--- a/libcxx/include/__cxx03/__ranges/drop_while_view.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_DROP_WHILE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_DROP_WHILE_VIEW_H
-
-#include <__cxx03/__algorithm/ranges_find_if_not.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <view _View, class _Pred>
- requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface<drop_while_view<_View, _Pred>> {
-public:
- _LIBCPP_HIDE_FROM_ABI drop_while_view()
- requires default_initializable<_View> && default_initializable<_Pred>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
- // Note: this duplicates a check in `optional` but provides a better error message.
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __pred_.__has_value(),
- "drop_while_view needs to have a non-empty predicate before calling begin() -- did a previous "
- "assignment to this drop_while_view fail?");
- if constexpr (_UseCache) {
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(ranges::find_if_not(__base_, std::cref(*__pred_)));
- }
- return *__cached_begin_;
- } else {
- return ranges::find_if_not(__base_, std::cref(*__pred_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() { return ranges::end(__base_); }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
- static constexpr bool _UseCache = forward_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
-};
-
-template <class _View, class _Pred>
-inline constexpr bool enable_borrowed_range<drop_while_view<_View, _Pred>> = enable_borrowed_range<_View>;
-
-template <class _Range, class _Pred>
-drop_while_view(_Range&&, _Pred) -> drop_while_view<views::all_t<_Range>, _Pred>;
-
-namespace views {
-namespace __drop_while {
-
-struct __fn {
- template <class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
- noexcept(noexcept(/**/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype(/*--*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
- return /*-------------*/ drop_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
- }
-
- template <class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
- }
-};
-
-} // namespace __drop_while
-
-inline namespace __cpo {
-inline constexpr auto drop_while = __drop_while::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_DROP_WHILE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/elements_view.h b/libcxx/include/__cxx03/__ranges/elements_view.h
deleted file mode 100644
index 9db16cde83be5..0000000000000
--- a/libcxx/include/__cxx03/__ranges/elements_view.h
+++ /dev/null
@@ -1,418 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ELEMENTS_VIEW_H
-#define _LIBCPP___CXX03___RANGES_ELEMENTS_VIEW_H
-
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/complex.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__tuple/tuple_element.h>
-#include <__cxx03/__tuple/tuple_like.h>
-#include <__cxx03/__tuple/tuple_size.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _Tp, size_t _Np>
-concept __has_tuple_element = __tuple_like<_Tp> && _Np < tuple_size<_Tp>::value;
-
-template <class _Tp, size_t _Np>
-concept __returnable_element = is_reference_v<_Tp> || move_constructible<tuple_element_t<_Np, _Tp>>;
-
-template <input_range _View, size_t _Np>
- requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> &&
- __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> &&
- __returnable_element<range_reference_t<_View>, _Np>
-class elements_view : public view_interface<elements_view<_View, _Np>> {
-private:
- template <bool>
- class __iterator;
-
- template <bool>
- class __sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI elements_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!__simple_view<_View>)
- {
- return __iterator</*_Const=*/false>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _View>
- {
- return __iterator</*_Const=*/true>(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View> && !common_range<_View>)
- {
- return __sentinel</*_Const=*/false>{ranges::end(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View> && common_range<_View>)
- {
- return __iterator</*_Const=*/false>{ranges::end(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View>
- {
- return __sentinel</*_Const=*/true>{ranges::end(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires common_range<const _View>
- {
- return __iterator</*_Const=*/true>{ranges::end(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return ranges::size(__base_);
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-};
-
-template <class, size_t>
-struct __elements_view_iterator_category_base {};
-
-template <forward_range _Base, size_t _Np>
-struct __elements_view_iterator_category_base<_Base, _Np> {
- static consteval auto __get_iterator_category() {
- using _Result = decltype(std::get<_Np>(*std::declval<iterator_t<_Base>>()));
- using _Cat = typename iterator_traits<iterator_t<_Base>>::iterator_category;
-
- if constexpr (!is_lvalue_reference_v<_Result>) {
- return input_iterator_tag{};
- } else if constexpr (derived_from<_Cat, random_access_iterator_tag>) {
- return random_access_iterator_tag{};
- } else {
- return _Cat{};
- }
- }
-
- using iterator_category = decltype(__get_iterator_category());
-};
-
-template <input_range _View, size_t _Np>
- requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> &&
- __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> &&
- __returnable_element<range_reference_t<_View>, _Np>
-template <bool _Const>
-class elements_view<_View, _Np>::__iterator
- : public __elements_view_iterator_category_base<__maybe_const<_Const, _View>, _Np> {
- template <bool>
- friend class __iterator;
-
- template <bool>
- friend class __sentinel;
-
- using _Base = __maybe_const<_Const, _View>;
-
- iterator_t<_Base> __current_ = iterator_t<_Base>();
-
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_element(const iterator_t<_Base>& __i) {
- if constexpr (is_reference_v<range_reference_t<_Base>>) {
- return std::get<_Np>(*__i);
- } else {
- using _Element = remove_cv_t<tuple_element_t<_Np, range_reference_t<_Base>>>;
- return static_cast<_Element>(std::get<_Np>(*__i));
- }
- }
-
- static consteval auto __get_iterator_concept() {
- if constexpr (random_access_range<_Base>) {
- return random_access_iterator_tag{};
- } else if constexpr (bidirectional_range<_Base>) {
- return bidirectional_iterator_tag{};
- } else if constexpr (forward_range<_Base>) {
- return forward_iterator_tag{};
- } else {
- return input_iterator_tag{};
- }
- }
-
-public:
- using iterator_concept = decltype(__get_iterator_concept());
- using value_type = remove_cvref_t<tuple_element_t<_Np, range_value_t<_Base>>>;
- using difference_type = range_difference_t<_Base>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator()
- requires default_initializable<iterator_t<_Base>>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> __current) : __current_(std::move(__current)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
- requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __current_(std::move(__i.__current_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- ++__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires forward_range<_Base>
- {
- auto __temp = *this;
- ++__current_;
- return __temp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires bidirectional_range<_Base>
- {
- --__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires bidirectional_range<_Base>
- {
- auto __temp = *this;
- --__current_;
- return __temp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
- requires random_access_range<_Base>
- {
- return __get_element(__current_ + __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<iterator_t<_Base>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ < __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __y < __x;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return !(__y < __x);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return !(__x < __y);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
- {
- return __x.__current_ <=> __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y)
- requires random_access_range<_Base>
- {
- return __iterator{__x} += __y;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __y + __x;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y)
- requires random_access_range<_Base>
- {
- return __iterator{__x} -= __y;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
- {
- return __x.__current_ - __y.__current_;
- }
-};
-
-template <input_range _View, size_t _Np>
- requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> &&
- __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> &&
- __returnable_element<range_reference_t<_View>, _Np>
-template <bool _Const>
-class elements_view<_View, _Np>::__sentinel {
-private:
- using _Base = __maybe_const<_Const, _View>;
- _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- template <bool>
- friend class __sentinel;
-
- template <bool _AnyConst>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_current(const __iterator<_AnyConst>& __iter) {
- return (__iter.__current_);
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __other)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__other.__end_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
-
- template <bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __get_current(__x) == __y.__end_;
- }
-
- template <bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __get_current(__x) - __y.__end_;
- }
-
- template <bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
- return __x.__end_ - __get_current(__y);
- }
-};
-
-template <class _Tp, size_t _Np>
-inline constexpr bool enable_borrowed_range<elements_view<_Tp, _Np>> = enable_borrowed_range<_Tp>;
-
-template <class _Tp>
-using keys_view = elements_view<_Tp, 0>;
-template <class _Tp>
-using values_view = elements_view<_Tp, 1>;
-
-namespace views {
-namespace __elements {
-
-template <size_t _Np>
-struct __fn : __range_adaptor_closure<__fn<_Np>> {
- template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- /**/ noexcept(noexcept(elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range))))
- /*------*/ -> decltype(elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range))) {
- /*-------------*/ return elements_view<all_t<_Range&&>, _Np>(std::forward<_Range>(__range));
- }
-};
-} // namespace __elements
-
-inline namespace __cpo {
-template <size_t _Np>
-inline constexpr auto elements = __elements::__fn<_Np>{};
-inline constexpr auto keys = elements<0>;
-inline constexpr auto values = elements<1>;
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_ELEMENTS_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/empty.h b/libcxx/include/__cxx03/__ranges/empty.h
deleted file mode 100644
index c72a17ecaf19d..0000000000000
--- a/libcxx/include/__cxx03/__ranges/empty.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_EMPTY_H
-#define _LIBCPP___CXX03___RANGES_EMPTY_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/size.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [range.prim.empty]
-
-namespace ranges {
-namespace __empty {
-template <class _Tp>
-concept __member_empty = requires(_Tp&& __t) { bool(__t.empty()); };
-
-template <class _Tp>
-concept __can_invoke_size = !__member_empty<_Tp> && requires(_Tp&& __t) { ranges::size(__t); };
-
-template <class _Tp>
-concept __can_compare_begin_end = !__member_empty<_Tp> && !__can_invoke_size<_Tp> && requires(_Tp&& __t) {
- bool(ranges::begin(__t) == ranges::end(__t));
- { ranges::begin(__t) } -> forward_iterator;
-};
-
-struct __fn {
- template <__member_empty _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) {
- return bool(__t.empty());
- }
-
- template <__can_invoke_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(ranges::size(__t))) {
- return ranges::size(__t) == 0;
- }
-
- template <__can_compare_begin_end _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const
- noexcept(noexcept(bool(ranges::begin(__t) == ranges::end(__t)))) {
- return ranges::begin(__t) == ranges::end(__t);
- }
-};
-} // namespace __empty
-
-inline namespace __cpo {
-inline constexpr auto empty = __empty::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_EMPTY_H
diff --git a/libcxx/include/__cxx03/__ranges/empty_view.h b/libcxx/include/__cxx03/__ranges/empty_view.h
deleted file mode 100644
index 11a77de6a3392..0000000000000
--- a/libcxx/include/__cxx03/__ranges/empty_view.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_EMPTY_VIEW_H
-#define _LIBCPP___CXX03___RANGES_EMPTY_VIEW_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _Tp>
- requires is_object_v<_Tp>
-class empty_view : public view_interface<empty_view<_Tp>> {
-public:
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* begin() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* end() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr _Tp* data() noexcept { return nullptr; }
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 0; }
- _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return true; }
-};
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
-
-namespace views {
-
-template <class _Tp>
-inline constexpr empty_view<_Tp> empty{};
-
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_EMPTY_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/enable_borrowed_range.h b/libcxx/include/__cxx03/__ranges/enable_borrowed_range.h
deleted file mode 100644
index 462053e35535d..0000000000000
--- a/libcxx/include/__cxx03/__ranges/enable_borrowed_range.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ENABLE_BORROWED_RANGE_H
-#define _LIBCPP___CXX03___RANGES_ENABLE_BORROWED_RANGE_H
-
-// These customization variables are used in <span> and <string_view>. The
-// separate header is used to avoid including the entire <ranges> header in
-// <span> and <string_view>.
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-// [range.range], ranges
-
-template <class>
-inline constexpr bool enable_borrowed_range = false;
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_ENABLE_BORROWED_RANGE_H
diff --git a/libcxx/include/__cxx03/__ranges/enable_view.h b/libcxx/include/__cxx03/__ranges/enable_view.h
deleted file mode 100644
index b8d78c29064b7..0000000000000
--- a/libcxx/include/__cxx03/__ranges/enable_view.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ENABLE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_ENABLE_VIEW_H
-
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_class.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__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 >= 20
-
-namespace ranges {
-
-struct view_base {};
-
-template <class _Derived>
- requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
-class view_interface;
-
-template <class _Op, class _Yp>
- requires is_convertible_v<_Op*, view_interface<_Yp>*>
-void __is_derived_from_view_interface(const _Op*, const view_interface<_Yp>*);
-
-template <class _Tp>
-inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires {
- ranges::__is_derived_from_view_interface((_Tp*)nullptr, (_Tp*)nullptr);
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_ENABLE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/filter_view.h b/libcxx/include/__cxx03/__ranges/filter_view.h
deleted file mode 100644
index b9beadb136652..0000000000000
--- a/libcxx/include/__cxx03/__ranges/filter_view.h
+++ /dev/null
@@ -1,260 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_FILTER_VIEW_H
-#define _LIBCPP___CXX03___RANGES_FILTER_VIEW_H
-
-#include <__cxx03/__algorithm/ranges_find_if.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/reference_wrapper.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<filter_view<_View, _Pred>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
- // We cache the result of begin() to allow providing an amortized O(1) begin() whenever
- // the underlying range is at least a forward_range.
- static constexpr bool _UseCache = forward_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
-
- class __iterator;
- class __sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI filter_view()
- requires default_initializable<_View> && default_initializable<_Pred>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
-
- template <class _Vp = _View>
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_Vp>
- {
- return __base_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Pred const& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
- // Note: this duplicates a check in `optional` but provides a better error message.
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate.");
- if constexpr (_UseCache) {
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_)));
- }
- return {*this, *__cached_begin_};
- } else {
- return {*this, ranges::find_if(__base_, std::ref(*__pred_))};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
- if constexpr (common_range<_View>)
- return __iterator{*this, ranges::end(__base_)};
- else
- return __sentinel{*this};
- }
-};
-
-template <class _Range, class _Pred>
-filter_view(_Range&&, _Pred) -> filter_view<views::all_t<_Range>, _Pred>;
-
-template <class _View>
-struct __filter_iterator_category {};
-
-template <forward_range _View>
-struct __filter_iterator_category<_View> {
- using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using iterator_category =
- _If<derived_from<_Cat, bidirectional_iterator_tag>,
- bidirectional_iterator_tag,
- _If<derived_from<_Cat, forward_iterator_tag>,
- forward_iterator_tag,
- /* else */ _Cat >>;
-};
-
-template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
-class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> {
-public:
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>();
- _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr;
-
- using iterator_concept =
- _If<bidirectional_range<_View>,
- bidirectional_iterator_tag,
- _If<forward_range<_View>,
- forward_iterator_tag,
- /* else */ input_iterator_tag >>;
- // using iterator_category = inherited;
- using value_type = range_value_t<_View>;
- using difference_type = range_difference_t<_View>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator()
- requires default_initializable<iterator_t<_View>>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(filter_view& __parent, iterator_t<_View> __current)
- : __current_(std::move(__current)), __parent_(std::addressof(__parent)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> const& base() const& noexcept { return __current_; }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr range_reference_t<_View> operator*() const { return *__current_; }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> operator->() const
- requires __has_arrow<iterator_t<_View>> && copyable<iterator_t<_View>>
- {
- return __current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- __current_ =
- ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), std::ref(*__parent_->__pred_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires forward_range<_View>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires bidirectional_range<_View>
- {
- do {
- --__current_;
- } while (!std::invoke(*__parent_->__pred_, *__current_));
- return *this;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires bidirectional_range<_View>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
- requires equality_comparable<iterator_t<_View>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_View>
- iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) {
- return ranges::iter_move(__it.__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void
- iter_swap(__iterator const& __x,
- __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
- requires indirectly_swappable<iterator_t<_View>>
- {
- return ranges::iter_swap(__x.__current_, __y.__current_);
- }
-};
-
-template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
- requires view<_View> && is_object_v<_Pred>
-class filter_view<_View, _Pred>::__sentinel {
-public:
- sentinel_t<_View> __end_ = sentinel_t<_View>();
-
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_View> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __sentinel const& __y) {
- return __x.__current_ == __y.__end_;
- }
-};
-
-namespace views {
-namespace __filter {
-struct __fn {
- template <class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
- noexcept(noexcept(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype(filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
- return filter_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
- }
-
- template <class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
- }
-};
-} // namespace __filter
-
-inline namespace __cpo {
-inline constexpr auto filter = __filter::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_FILTER_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/from_range.h b/libcxx/include/__cxx03/__ranges/from_range.h
deleted file mode 100644
index 2f0c827f827fe..0000000000000
--- a/libcxx/include/__cxx03/__ranges/from_range.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_FROM_RANGE_H
-#define _LIBCPP___CXX03___RANGES_FROM_RANGE_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-struct from_range_t {
- explicit from_range_t() = default;
-};
-
-inline constexpr from_range_t from_range{};
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_FROM_RANGE_H
diff --git a/libcxx/include/__cxx03/__ranges/iota_view.h b/libcxx/include/__cxx03/__ranges/iota_view.h
deleted file mode 100644
index 5fa1e8151af20..0000000000000
--- a/libcxx/include/__cxx03/__ranges/iota_view.h
+++ /dev/null
@@ -1,404 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_IOTA_VIEW_H
-#define _LIBCPP___CXX03___RANGES_IOTA_VIEW_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__concepts/totally_ordered.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/unreachable_sentinel.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/type_identity.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _Int>
-struct __get_wider_signed {
- consteval static auto __call() {
- if constexpr (sizeof(_Int) < sizeof(short))
- return type_identity<short>{};
- else if constexpr (sizeof(_Int) < sizeof(int))
- return type_identity<int>{};
- else if constexpr (sizeof(_Int) < sizeof(long))
- return type_identity<long>{};
- else
- return type_identity<long long>{};
-
- static_assert(
- sizeof(_Int) <= sizeof(long long), "Found integer-like type that is bigger than largest integer like type.");
- }
-
- using type = typename decltype(__call())::type;
-};
-
-template <class _Start>
-using _IotaDiffT =
- typename _If< (!integral<_Start> || sizeof(iter_difference_t<_Start>) > sizeof(_Start)),
- type_identity<iter_difference_t<_Start>>,
- __get_wider_signed<_Start> >::type;
-
-template <class _Iter>
-concept __decrementable = incrementable<_Iter> && requires(_Iter __i) {
- { --__i } -> same_as<_Iter&>;
- { __i-- } -> same_as<_Iter>;
-};
-
-template <class _Iter>
-concept __advanceable =
- __decrementable<_Iter> && totally_ordered<_Iter> &&
- requires(_Iter __i, const _Iter __j, const _IotaDiffT<_Iter> __n) {
- { __i += __n } -> same_as<_Iter&>;
- { __i -= __n } -> same_as<_Iter&>;
- _Iter(__j + __n);
- _Iter(__n + __j);
- _Iter(__j - __n);
- { __j - __j } -> convertible_to<_IotaDiffT<_Iter>>;
- };
-
-template <class>
-struct __iota_iterator_category {};
-
-template <incrementable _Tp>
-struct __iota_iterator_category<_Tp> {
- using iterator_category = input_iterator_tag;
-};
-
-template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t>
- requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start>
-class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
- struct __iterator : public __iota_iterator_category<_Start> {
- friend class iota_view;
-
- using iterator_concept =
- _If<__advanceable<_Start>,
- random_access_iterator_tag,
- _If<__decrementable<_Start>,
- bidirectional_iterator_tag,
- _If<incrementable<_Start>,
- forward_iterator_tag,
- /*Else*/ input_iterator_tag>>>;
-
- using value_type = _Start;
- using difference_type = _IotaDiffT<_Start>;
-
- _Start __value_ = _Start();
-
- _LIBCPP_HIDE_FROM_ABI __iterator()
- requires default_initializable<_Start>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) {
- return __value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- ++__value_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires incrementable<_Start>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires __decrementable<_Start>
- {
- --__value_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires __decrementable<_Start>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ += static_cast<_Start>(__n);
- } else {
- __value_ -= static_cast<_Start>(-__n);
- }
- } else {
- __value_ += __n;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) {
- if (__n >= difference_type(0)) {
- __value_ -= static_cast<_Start>(__n);
- } else {
- __value_ += static_cast<_Start>(-__n);
- }
- } else {
- __value_ -= __n;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Start operator[](difference_type __n) const
- requires __advanceable<_Start>
- {
- return _Start(__value_ + __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<_Start>
- {
- return __x.__value_ == __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __x.__value_ < __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return __y < __x;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__y < __x);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start>
- {
- return !(__x < __y);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires totally_ordered<_Start> && three_way_comparable<_Start>
- {
- return __x.__value_ <=> __y.__value_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i += __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires __advanceable<_Start>
- {
- return __i + __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires __advanceable<_Start>
- {
- __i -= __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires __advanceable<_Start>
- {
- if constexpr (__integer_like<_Start>) {
- if constexpr (__signed_integer_like<_Start>) {
- return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_));
- }
- if (__y.__value_ > __x.__value_) {
- return difference_type(-difference_type(__y.__value_ - __x.__value_));
- }
- return difference_type(__x.__value_ - __y.__value_);
- }
- return __x.__value_ - __y.__value_;
- }
- };
-
- struct __sentinel {
- friend class iota_view;
-
- private:
- _BoundSentinel __bound_sentinel_ = _BoundSentinel();
-
- public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_BoundSentinel __bound_sentinel)
- : __bound_sentinel_(std::move(__bound_sentinel)) {}
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __x.__value_ == __y.__bound_sentinel_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
- operator-(const __iterator& __x, const __sentinel& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return __x.__value_ - __y.__bound_sentinel_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Start>
- operator-(const __sentinel& __x, const __iterator& __y)
- requires sized_sentinel_for<_BoundSentinel, _Start>
- {
- return -(__y - __x);
- }
- };
-
- _Start __value_ = _Start();
- _BoundSentinel __bound_sentinel_ = _BoundSentinel();
-
-public:
- _LIBCPP_HIDE_FROM_ABI iota_view()
- requires default_initializable<_Start>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
- iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
- : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
- // Validate the precondition if possible.
- if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(
- bool(__value_ <= __bound_sentinel_), "iota_view: bound must be reachable from value");
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
- requires same_as<_Start, _BoundSentinel>
- : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
- requires same_as<_BoundSentinel, unreachable_sentinel_t>
- : iota_view(std::move(__first.__value_), std::move(__last)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
- requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
- : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator{__value_}; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
- if constexpr (same_as<_BoundSentinel, unreachable_sentinel_t>)
- return unreachable_sentinel;
- else
- return __sentinel{__bound_sentinel_};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
- requires same_as<_Start, _BoundSentinel>
- {
- return __iterator{__bound_sentinel_};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __value_ == __bound_sentinel_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
- (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
- {
- if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
- return (__value_ < 0)
- ? ((__bound_sentinel_ < 0)
- ? std::__to_unsigned_like(-__value_) - std::__to_unsigned_like(-__bound_sentinel_)
- : std::__to_unsigned_like(__bound_sentinel_) + std::__to_unsigned_like(-__value_))
- : std::__to_unsigned_like(__bound_sentinel_) - std::__to_unsigned_like(__value_);
- } else {
- return std::__to_unsigned_like(__bound_sentinel_ - __value_);
- }
- }
-};
-
-template <class _Start, class _BoundSentinel>
- requires(!__integer_like<_Start> || !__integer_like<_BoundSentinel> ||
- (__signed_integer_like<_Start> == __signed_integer_like<_BoundSentinel>))
-iota_view(_Start, _BoundSentinel) -> iota_view<_Start, _BoundSentinel>;
-
-template <class _Start, class _BoundSentinel>
-inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true;
-
-namespace views {
-namespace __iota {
-struct __fn {
- template <class _Start>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start) const
- noexcept(noexcept(ranges::iota_view(std::forward<_Start>(__start))))
- -> decltype(ranges::iota_view(std::forward<_Start>(__start))) {
- return ranges::iota_view(std::forward<_Start>(__start));
- }
-
- template <class _Start, class _BoundSentinel>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Start&& __start, _BoundSentinel&& __bound_sentinel) const noexcept(
- noexcept(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))))
- -> decltype(ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel))) {
- return ranges::iota_view(std::forward<_Start>(__start), std::forward<_BoundSentinel>(__bound_sentinel));
- }
-};
-} // namespace __iota
-
-inline namespace __cpo {
-inline constexpr auto iota = __iota::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_IOTA_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/istream_view.h b/libcxx/include/__cxx03/__ranges/istream_view.h
deleted file mode 100644
index b54dc137690a0..0000000000000
--- a/libcxx/include/__cxx03/__ranges/istream_view.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ISTREAM_VIEW_H
-#define _LIBCPP___CXX03___RANGES_ISTREAM_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/istream.h>
-#include <__cxx03/__fwd/string.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace ranges {
-
-template <class _Val, class _CharT, class _Traits>
-concept __stream_extractable = requires(basic_istream<_CharT, _Traits>& __is, _Val& __t) { __is >> __t; };
-
-template <movable _Val, class _CharT, class _Traits = char_traits<_CharT>>
- requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits>
-class basic_istream_view : public view_interface<basic_istream_view<_Val, _CharT, _Traits>> {
- class __iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream)
- : __stream_(std::addressof(__stream)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
- *__stream_ >> __value_;
- return __iterator{*this};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
-
-private:
- basic_istream<_CharT, _Traits>* __stream_;
- _LIBCPP_NO_UNIQUE_ADDRESS _Val __value_ = _Val();
-};
-
-template <movable _Val, class _CharT, class _Traits>
- requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits>
-class basic_istream_view<_Val, _CharT, _Traits>::__iterator {
-public:
- using iterator_concept = input_iterator_tag;
- using difference_type = ptrdiff_t;
- using value_type = _Val;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept
- : __parent_(std::addressof(__parent)) {}
-
- __iterator(const __iterator&) = delete;
- _LIBCPP_HIDE_FROM_ABI __iterator(__iterator&&) = default;
-
- __iterator& operator=(const __iterator&) = delete;
- _LIBCPP_HIDE_FROM_ABI __iterator& operator=(__iterator&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI __iterator& operator++() {
- *__parent_->__stream_ >> __parent_->__value_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; }
-
- _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; }
-
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) {
- return !*__x.__get_parent_stream();
- }
-
-private:
- basic_istream_view<_Val, _CharT, _Traits>* __parent_;
-
- _LIBCPP_HIDE_FROM_ABI constexpr basic_istream<_CharT, _Traits>* __get_parent_stream() const {
- return __parent_->__stream_;
- }
-};
-
-template <class _Val>
-using istream_view = basic_istream_view<_Val, char>;
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class _Val>
-using wistream_view = basic_istream_view<_Val, wchar_t>;
-# endif
-
-namespace views {
-namespace __istream {
-
-// clang-format off
-template <class _Tp>
-struct __fn {
- template <class _Up, class _UnCVRef = remove_cvref_t<_Up>>
- requires derived_from<_UnCVRef, basic_istream<typename _UnCVRef::char_type,
- typename _UnCVRef::traits_type>>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const
- noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type,
- typename _UnCVRef::traits_type>(std::forward<_Up>(__u))))
- -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type,
- typename _UnCVRef::traits_type>(std::forward<_Up>(__u)))
- { return basic_istream_view<_Tp, typename _UnCVRef::char_type,
- typename _UnCVRef::traits_type>(std::forward<_Up>(__u));
- }
-};
-// clang-format on
-
-} // namespace __istream
-
-inline namespace __cpo {
-template <class _Tp>
-inline constexpr auto istream = __istream::__fn<_Tp>{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#endif // _LIBCPP___CXX03___RANGES_ISTREAM_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/join_view.h b/libcxx/include/__cxx03/__ranges/join_view.h
deleted file mode 100644
index 3496fc9810704..0000000000000
--- a/libcxx/include/__cxx03/__ranges/join_view.h
+++ /dev/null
@@ -1,423 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_JOIN_VIEW_H
-#define _LIBCPP___CXX03___RANGES_JOIN_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/iterator_with_data.h>
-#include <__cxx03/__iterator/segmented_iterator.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__utility/as_lvalue.h>
-#include <__cxx03/__utility/empty.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class>
-struct __join_view_iterator_category {};
-
-template <class _View>
- requires is_reference_v<range_reference_t<_View>> && forward_range<_View> && forward_range<range_reference_t<_View>>
-struct __join_view_iterator_category<_View> {
- using _OuterC = typename iterator_traits<iterator_t<_View>>::iterator_category;
- using _InnerC = typename iterator_traits<iterator_t<range_reference_t<_View>>>::iterator_category;
-
- using iterator_category =
- _If< derived_from<_OuterC, bidirectional_iterator_tag> && derived_from<_InnerC, bidirectional_iterator_tag> &&
- common_range<range_reference_t<_View>>,
- bidirectional_iterator_tag,
- _If< derived_from<_OuterC, forward_iterator_tag> && derived_from<_InnerC, forward_iterator_tag>,
- forward_iterator_tag,
- input_iterator_tag > >;
-};
-
-template <input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
-class join_view : public view_interface<join_view<_View>> {
-private:
- using _InnerRange = range_reference_t<_View>;
-
- template <bool>
- struct __iterator;
-
- template <bool>
- struct __sentinel;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
- static constexpr bool _UseOuterCache = !forward_range<_View>;
- using _OuterCache = _If<_UseOuterCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterCache __outer_;
-
- static constexpr bool _UseInnerCache = !is_reference_v<_InnerRange>;
- using _InnerCache = _If<_UseInnerCache, __non_propagating_cache<remove_cvref_t<_InnerRange>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _InnerCache __inner_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI join_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
- if constexpr (forward_range<_View>) {
- constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>;
- return __iterator<__use_const>{*this, ranges::begin(__base_)};
- } else {
- __outer_.__emplace(ranges::begin(__base_));
- return __iterator<false>{*this};
- }
- }
-
- template <class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- return __iterator<true>{*this, ranges::begin(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
- if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> &&
- common_range<_View> && common_range<_InnerRange>)
- return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
- else
- return __sentinel<__simple_view<_View>>{*this};
- }
-
- template <class _V2 = _View>
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
- input_range<range_reference_t<const _V2>>
- {
- using _ConstInnerRange = range_reference_t<const _View>;
- if constexpr (forward_range<_ConstInnerRange> && common_range<const _View> && common_range<_ConstInnerRange>) {
- return __iterator<true>{*this, ranges::end(__base_)};
- } else {
- return __sentinel<true>{*this};
- }
- }
-};
-
-template <input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
-template <bool _Const>
-struct join_view<_View>::__sentinel {
-private:
- template <bool>
- friend struct __sentinel;
-
- using _Parent = __maybe_const<_Const, join_view>;
- using _Base = __maybe_const<_Const, _View>;
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
-
- template <bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__get_outer() == __y.__end_;
- }
-};
-
-// https://reviews.llvm.org/D142811#inline-1383022
-// To simplify the segmented iterator traits specialization,
-// make the iterator `final`
-template <input_range _View>
- requires view<_View> && input_range<range_reference_t<_View>>
-template <bool _Const>
-struct join_view<_View>::__iterator final : public __join_view_iterator_category<__maybe_const<_Const, _View>> {
- friend join_view;
-
- template <class>
- friend struct std::__segmented_iterator_traits;
-
- static constexpr bool __is_join_view_iterator = true;
-
-private:
- using _Parent = __maybe_const<_Const, join_view<_View>>;
- using _Base = __maybe_const<_Const, _View>;
- using _Outer = iterator_t<_Base>;
- using _Inner = iterator_t<range_reference_t<_Base>>;
- using _InnerRange = range_reference_t<_View>;
-
- static_assert(!_Const || forward_range<_Base>, "Const can only be true when Base models forward_range.");
-
- static constexpr bool __ref_is_glvalue = is_reference_v<range_reference_t<_Base>>;
-
- static constexpr bool _OuterPresent = forward_range<_Base>;
- using _OuterType = _If<_OuterPresent, _Outer, std::__empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _OuterType __outer_ = _OuterType();
-
- optional<_Inner> __inner_;
- _Parent* __parent_ = nullptr;
-
- _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() {
- for (; __get_outer() != ranges::end(__parent_->__base_); ++__get_outer()) {
- auto&& __inner = [this]() -> auto&& {
- if constexpr (__ref_is_glvalue)
- return *__get_outer();
- else
- return __parent_->__inner_.__emplace_from([&]() -> decltype(auto) { return *__get_outer(); });
- }();
- __inner_ = ranges::begin(__inner);
- if (*__inner_ != ranges::end(__inner))
- return;
- }
-
- if constexpr (__ref_is_glvalue)
- __inner_.reset();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Outer& __get_outer() {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Outer& __get_outer() const {
- if constexpr (forward_range<_Base>) {
- return __outer_;
- } else {
- return *__parent_->__outer_;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, _Outer __outer)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __parent_(std::addressof(__parent)) {
- __satisfy();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(_Parent& __parent)
- requires(!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {
- __satisfy();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner)
- requires forward_range<_Base>
- : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {}
-
-public:
- using iterator_concept =
- _If< __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>,
- bidirectional_iterator_tag,
- _If< __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>,
- forward_iterator_tag,
- input_iterator_tag > >;
-
- using value_type = range_value_t<range_reference_t<_Base>>;
-
- using difference_type = common_type_t< range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
- requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner>
- : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const
- requires __has_arrow<_Inner> && copyable<_Inner>
- {
- return *__inner_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- auto __get_inner_range = [&]() -> decltype(auto) {
- if constexpr (__ref_is_glvalue)
- return *__get_outer();
- else
- return *__parent_->__inner_;
- };
- if (++*__inner_ == ranges::end(std::__as_lvalue(__get_inner_range()))) {
- ++__get_outer();
- __satisfy();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- if (__outer_ == ranges::end(__parent_->__base_))
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
-
- // Skip empty inner ranges when going backwards.
- while (*__inner_ == ranges::begin(std::__as_lvalue(*__outer_))) {
- __inner_ = ranges::end(std::__as_lvalue(*--__outer_));
- }
-
- --*__inner_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> &&
- common_range<range_reference_t<_Base>>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<iterator_t<range_reference_t<_Base>>>
- {
- return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
- iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) {
- return ranges::iter_move(*__i.__inner_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void
- iter_swap(const __iterator& __x,
- const __iterator& __y) noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_)))
- requires indirectly_swappable<_Inner>
- {
- return ranges::iter_swap(*__x.__inner_, *__y.__inner_);
- }
-};
-
-template <class _Range>
-explicit join_view(_Range&&) -> join_view<views::all_t<_Range>>;
-
-namespace views {
-namespace __join_view {
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype(join_view<all_t<_Range&&>>(std::forward<_Range>(__range))) {
- return join_view<all_t<_Range&&>>(std::forward<_Range>(__range));
- }
-};
-} // namespace __join_view
-inline namespace __cpo {
-inline constexpr auto join = __join_view::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-template <class _JoinViewIterator>
- requires(_JoinViewIterator::__is_join_view_iterator && ranges::common_range<typename _JoinViewIterator::_Parent> &&
- __has_random_access_iterator_category<typename _JoinViewIterator::_Outer>::value &&
- __has_random_access_iterator_category<typename _JoinViewIterator::_Inner>::value)
-struct __segmented_iterator_traits<_JoinViewIterator> {
- using __segment_iterator =
- _LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>;
- using __local_iterator = typename _JoinViewIterator::_Inner;
-
- // TODO: Would it make sense to enable the optimization for other iterator types?
-
- static constexpr _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return __segment_iterator(--__iter.__outer_, __iter.__parent_);
- return __segment_iterator(__iter.__outer_, __iter.__parent_);
- }
-
- static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_JoinViewIterator __iter) {
- if (ranges::empty(__iter.__parent_->__base_))
- return {};
- if (!__iter.__inner_.has_value())
- return ranges::end(*--__iter.__outer_);
- return *__iter.__inner_;
- }
-
- static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) {
- return ranges::begin(*__iter.__get_iter());
- }
-
- static constexpr _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
- return ranges::end(*__iter.__get_iter());
- }
-
- static constexpr _LIBCPP_HIDE_FROM_ABI _JoinViewIterator
- __compose(__segment_iterator __seg_iter, __local_iterator __local_iter) {
- return _JoinViewIterator(
- std::move(__seg_iter).__get_data(), std::move(__seg_iter).__get_iter(), std::move(__local_iter));
- }
-};
-
-#endif // #if _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_JOIN_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/lazy_split_view.h b/libcxx/include/__cxx03/__ranges/lazy_split_view.h
deleted file mode 100644
index 8dc05e0ec6f95..0000000000000
--- a/libcxx/include/__cxx03/__ranges/lazy_split_view.h
+++ /dev/null
@@ -1,441 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_LAZY_SPLIT_VIEW_H
-#define _LIBCPP___CXX03___RANGES_LAZY_SPLIT_VIEW_H
-
-#include <__cxx03/__algorithm/ranges_find.h>
-#include <__cxx03/__algorithm/ranges_mismatch.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/single_view.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <auto>
-struct __require_constant;
-
-template <class _Range>
-concept __tiny_range = sized_range<_Range> && requires {
- typename __require_constant<remove_reference_t<_Range>::size()>;
-} && (remove_reference_t<_Range>::size() <= 1);
-
-template <input_range _View, forward_range _Pattern>
- requires view<_View> && view<_Pattern> &&
- indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> &&
- (forward_range<_View> || __tiny_range<_Pattern>)
-class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern();
-
- using _MaybeCurrent = _If<!forward_range<_View>, __non_propagating_cache<iterator_t<_View>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
-
- template <bool>
- struct __outer_iterator;
- template <bool>
- struct __inner_iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI lazy_split_view()
- requires default_initializable<_View> && default_initializable<_Pattern>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
- : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
-
- template <input_range _Range>
- requires constructible_from<_View, views::all_t<_Range>> &&
- constructible_from<_Pattern, single_view<range_value_t<_Range>>>
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
- : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
- if constexpr (forward_range<_View>) {
- return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)};
- } else {
- __current_.__emplace(ranges::begin(__base_));
- return __outer_iterator<false>{*this};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires forward_range<_View> && forward_range<const _View>
- {
- return __outer_iterator<true>{*this, ranges::begin(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires forward_range<_View> && common_range<_View>
- {
- return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
- if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) {
- return __outer_iterator<true>{*this, ranges::end(__base_)};
- } else {
- return default_sentinel;
- }
- }
-
-private:
- template <class>
- struct __outer_iterator_category {};
-
- template <forward_range _Tp>
- struct __outer_iterator_category<_Tp> {
- using iterator_category = input_iterator_tag;
- };
-
- template <bool _Const>
- struct __outer_iterator : __outer_iterator_category<__maybe_const<_Const, _View>> {
- private:
- template <bool>
- friend struct __inner_iterator;
- friend __outer_iterator<true>;
-
- using _Parent = __maybe_const<_Const, lazy_split_view>;
- using _Base = __maybe_const<_Const, _View>;
-
- _Parent* __parent_ = nullptr;
- using _MaybeCurrent = _If<forward_range<_View>, iterator_t<_Base>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _MaybeCurrent __current_ = _MaybeCurrent();
- bool __trailing_empty_ = false;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __current() noexcept {
- if constexpr (forward_range<_View>) {
- return __current_;
- } else {
- return *__parent_->__current_;
- }
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __current() const noexcept {
- if constexpr (forward_range<_View>) {
- return __current_;
- } else {
- return *__parent_->__current_;
- }
- }
-
- // Workaround for the GCC issue that doesn't allow calling `__parent_->__base_` from friend functions (because
- // `__base_` is private).
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __parent_base() const noexcept { return __parent_->__base_; }
-
- public:
- // using iterator_category = inherited;
- using iterator_concept = conditional_t<forward_range<_Base>, forward_iterator_tag, input_iterator_tag>;
- using difference_type = range_difference_t<_Base>;
-
- struct value_type : view_interface<value_type> {
- private:
- __outer_iterator __i_ = __outer_iterator();
-
- public:
- _LIBCPP_HIDE_FROM_ABI value_type() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
- _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
- };
-
- _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __outer_iterator(_Parent& __parent)
- requires(!forward_range<_Base>)
- : __parent_(std::addressof(__parent)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(_Parent& __parent, iterator_t<_Base> __current)
- requires forward_range<_Base>
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator(__outer_iterator<!_Const> __i)
- requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() {
- const auto __end = ranges::end(__parent_->__base_);
- if (__current() == __end) {
- __trailing_empty_ = false;
- return *this;
- }
-
- const auto [__pbegin, __pend] = ranges::subrange{__parent_->__pattern_};
- if (__pbegin == __pend) {
- // Empty pattern: split on every element in the input range
- ++__current();
-
- } else if constexpr (__tiny_range<_Pattern>) {
- // One-element pattern: we can use `ranges::find`.
- __current() = ranges::find(std::move(__current()), __end, *__pbegin);
- if (__current() != __end) {
- // Make sure we point to after the separator we just found.
- ++__current();
- if (__current() == __end)
- __trailing_empty_ = true;
- }
-
- } else {
- // General case for n-element pattern.
- do {
- const auto [__b, __p] = ranges::mismatch(__current(), __end, __pbegin, __pend);
- if (__p == __pend) {
- __current() = __b;
- if (__current() == __end) {
- __trailing_empty_ = true;
- }
- break; // The pattern matched; skip it.
- }
- } while (++__current() != __end);
- }
-
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
- if constexpr (forward_range<_Base>) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
-
- } else {
- ++*this;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, const __outer_iterator& __y)
- requires forward_range<_Base>
- {
- return __x.__current_ == __y.__current_ && __x.__trailing_empty_ == __y.__trailing_empty_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) {
- _LIBCPP_ASSERT_NON_NULL(__x.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
- return __x.__current() == ranges::end(__x.__parent_base()) && !__x.__trailing_empty_;
- }
- };
-
- template <class>
- struct __inner_iterator_category {};
-
- template <forward_range _Tp>
- struct __inner_iterator_category<_Tp> {
- using iterator_category =
- _If< derived_from<typename iterator_traits<iterator_t<_Tp>>::iterator_category, forward_iterator_tag>,
- forward_iterator_tag,
- typename iterator_traits<iterator_t<_Tp>>::iterator_category >;
- };
-
- template <bool _Const>
- struct __inner_iterator : __inner_iterator_category<__maybe_const<_Const, _View>> {
- private:
- using _Base = __maybe_const<_Const, _View>;
- // Workaround for a GCC issue.
- static constexpr bool _OuterConst = _Const;
- __outer_iterator<_Const> __i_ = __outer_iterator<_OuterConst>();
- bool __incremented_ = false;
-
- // Note: these private functions are necessary because GCC doesn't allow calls to private members of `__i_` from
- // free functions that are friends of `inner-iterator`.
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __is_done() const {
- _LIBCPP_ASSERT_NON_NULL(__i_.__parent_ != nullptr, "Cannot call comparison on a default-constructed iterator.");
-
- auto [__pcur, __pend] = ranges::subrange{__i_.__parent_->__pattern_};
- auto __end = ranges::end(__i_.__parent_->__base_);
-
- if constexpr (__tiny_range<_Pattern>) {
- const auto& __cur = __i_.__current();
- if (__cur == __end)
- return true;
- if (__pcur == __pend)
- return __incremented_;
-
- return *__cur == *__pcur;
-
- } else {
- auto __cur = __i_.__current();
- if (__cur == __end)
- return true;
- if (__pcur == __pend)
- return __incremented_;
-
- do {
- if (*__cur != *__pcur)
- return false;
- if (++__pcur == __pend)
- return true;
- } while (++__cur != __end);
-
- return false;
- }
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto& __outer_current() noexcept { return __i_.__current(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const auto& __outer_current() const noexcept {
- return __i_.__current();
- }
-
- public:
- // using iterator_category = inherited;
- using iterator_concept = typename __outer_iterator<_Const>::iterator_concept;
- using value_type = range_value_t<_Base>;
- using difference_type = range_difference_t<_Base>;
-
- _LIBCPP_HIDE_FROM_ABI __inner_iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() &&
- requires forward_range<_View>
- {
- return std::move(__i_.__current());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() {
- __incremented_ = true;
-
- if constexpr (!forward_range<_Base>) {
- if constexpr (_Pattern::size() == 0) {
- return *this;
- }
- }
-
- ++__i_.__current();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
- if constexpr (forward_range<_Base>) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
-
- } else {
- ++*this;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, const __inner_iterator& __y)
- requires forward_range<_Base>
- {
- return __x.__outer_current() == __y.__outer_current();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __inner_iterator& __x, default_sentinel_t) {
- return __x.__is_done();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
- iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
- return ranges::iter_move(__i.__outer_current());
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(
- const __inner_iterator& __x,
- const __inner_iterator& __y) noexcept(noexcept(ranges::iter_swap(__x.__outer_current(), __y.__outer_current())))
- requires indirectly_swappable<iterator_t<_Base>>
- {
- ranges::iter_swap(__x.__outer_current(), __y.__outer_current());
- }
- };
-};
-
-template <class _Range, class _Pattern>
-lazy_split_view(_Range&&, _Pattern&&) -> lazy_split_view<views::all_t<_Range>, views::all_t<_Pattern>>;
-
-template <input_range _Range>
-lazy_split_view(_Range&&,
- range_value_t<_Range>) -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
-
-namespace views {
-namespace __lazy_split_view {
-struct __fn {
- template <class _Range, class _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
- noexcept(noexcept(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
- -> decltype(lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))) {
- return lazy_split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern));
- }
-
- template <class _Pattern>
- requires constructible_from<decay_t<_Pattern>, _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
- }
-};
-} // namespace __lazy_split_view
-
-inline namespace __cpo {
-inline constexpr auto lazy_split = __lazy_split_view::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_LAZY_SPLIT_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/movable_box.h b/libcxx/include/__cxx03/__ranges/movable_box.h
deleted file mode 100644
index 7dc8b95b28bb4..0000000000000
--- a/libcxx/include/__cxx03/__ranges/movable_box.h
+++ /dev/null
@@ -1,247 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_MOVABLE_BOX_H
-#define _LIBCPP___CXX03___RANGES_MOVABLE_BOX_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// __movable_box allows turning a type that is move-constructible (but maybe not move-assignable) into
-// a type that is both move-constructible and move-assignable. It does that by introducing an empty state
-// and basically doing destroy-then-copy-construct in the assignment operator. The empty state is necessary
-// to handle the case where the copy construction fails after destroying the object.
-//
-// In some cases, we can completely avoid the use of an empty state; we provide a specialization of
-// __movable_box that does this, see below for the details.
-
-// until C++23, `__movable_box` was named `__copyable_box` and required the stored type to be copy-constructible, not
-// just move-constructible; we preserve the old behavior in pre-C++23 modes.
-template <class _Tp>
-concept __movable_box_object =
-# if _LIBCPP_STD_VER >= 23
- move_constructible<_Tp>
-# else
- copy_constructible<_Tp>
-# endif
- && is_object_v<_Tp>;
-
-namespace ranges {
-// Primary template - uses std::optional and introduces an empty state in case assignment fails.
-template <__movable_box_object _Tp>
-class __movable_box {
- _LIBCPP_NO_UNIQUE_ADDRESS optional<_Tp> __val_;
-
-public:
- template <class... _Args>
- requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, _Args...>)
- : __val_(in_place, std::forward<_Args>(__args)...) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>)
- requires default_initializable<_Tp>
- : __val_(in_place) {}
-
- _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box const&) = default;
- _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box&
- operator=(__movable_box const& __other) noexcept(is_nothrow_copy_constructible_v<_Tp>)
-# if _LIBCPP_STD_VER >= 23
- requires copy_constructible<_Tp>
-# endif
- {
- if (this != std::addressof(__other)) {
- if (__other.__has_value())
- __val_.emplace(*__other);
- else
- __val_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box&&)
- requires movable<_Tp>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box&
- operator=(__movable_box&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) {
- if (this != std::addressof(__other)) {
- if (__other.__has_value())
- __val_.emplace(std::move(*__other));
- else
- __val_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return *__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return *__val_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return __val_.operator->(); }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return __val_.operator->(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return __val_.has_value(); }
-};
-
-// This partial specialization implements an optimization for when we know we don't need to store
-// an empty state to represent failure to perform an assignment. For copy-assignment, this happens:
-//
-// 1. If the type is copyable (which includes copy-assignment), we can use the type's own assignment operator
-// directly and avoid using std::optional.
-// 2. If the type is not copyable, but it is nothrow-copy-constructible, then we can implement assignment as
-// destroy-and-then-construct and we know it will never fail, so we don't need an empty state.
-//
-// The exact same reasoning can be applied for move-assignment, with copyable replaced by movable and
-// nothrow-copy-constructible replaced by nothrow-move-constructible. This specialization is enabled
-// whenever we can apply any of these optimizations for both the copy assignment and the move assignment
-// operator.
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Tp>
-concept __doesnt_need_empty_state =
- (copy_constructible<_Tp>
- // 1. If copy_constructible<T> is true, movable-box<T> should store only a T if either T models
- // copyable, or is_nothrow_move_constructible_v<T> && is_nothrow_copy_constructible_v<T> is true.
- ? copyable<_Tp> || (is_nothrow_move_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Tp>)
- // 2. Otherwise, movable-box<T> should store only a T if either T models movable or
- // is_nothrow_move_constructible_v<T> is true.
- : movable<_Tp> || is_nothrow_move_constructible_v<_Tp>);
-
-// When _Tp doesn't have an assignment operator, we must implement __movable_box's assignment operator
-// by doing destroy_at followed by construct_at. However, that implementation strategy leads to UB if the nested
-// _Tp is potentially overlapping, as it is doing a non-transparent replacement of the sub-object, which means that
-// we're not considered "nested" inside the movable-box anymore, and since we're not nested within it, [basic.life]/1.5
-// says that we essentially just reused the storage of the movable-box for a completely unrelated object and ended the
-// movable-box's lifetime.
-// https://github.com/llvm/llvm-project/issues/70494#issuecomment-1845646490
-//
-// Hence, when the _Tp doesn't have an assignment operator, we can't risk making it a potentially-overlapping
-// subobject because of the above, and we don't use [[no_unique_address]] in that case.
-template <class _Tp>
-concept __can_use_no_unique_address = (copy_constructible<_Tp> ? copyable<_Tp> : movable<_Tp>);
-
-# else
-
-template <class _Tp>
-concept __doesnt_need_empty_state_for_copy = copyable<_Tp> || is_nothrow_copy_constructible_v<_Tp>;
-
-template <class _Tp>
-concept __doesnt_need_empty_state_for_move = movable<_Tp> || is_nothrow_move_constructible_v<_Tp>;
-
-template <class _Tp>
-concept __doesnt_need_empty_state = __doesnt_need_empty_state_for_copy<_Tp> && __doesnt_need_empty_state_for_move<_Tp>;
-
-template <class _Tp>
-concept __can_use_no_unique_address = copyable<_Tp>;
-# endif
-
-template <class _Tp>
-struct __movable_box_holder {
- _Tp __val_;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...) {}
-};
-
-template <class _Tp>
- requires __can_use_no_unique_address<_Tp>
-struct __movable_box_holder<_Tp> {
- _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box_holder(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...) {}
-};
-
-template <__movable_box_object _Tp>
- requires __doesnt_need_empty_state<_Tp>
-class __movable_box<_Tp> {
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box_holder<_Tp> __holder_;
-
-public:
- template <class... _Args>
- requires is_constructible_v<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __movable_box(in_place_t __inplace, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, _Args...>)
- : __holder_(__inplace, std::forward<_Args>(__args)...) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box() noexcept(is_nothrow_default_constructible_v<_Tp>)
- requires default_initializable<_Tp>
- : __holder_(in_place_t{}) {}
-
- _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box const&) = default;
- _LIBCPP_HIDE_FROM_ABI __movable_box(__movable_box&&) = default;
-
- // Implementation of assignment operators in case we perform optimization (1)
- _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box const&)
- requires copyable<_Tp>
- = default;
- _LIBCPP_HIDE_FROM_ABI __movable_box& operator=(__movable_box&&)
- requires movable<_Tp>
- = default;
-
- // Implementation of assignment operators in case we perform optimization (2)
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box const& __other) noexcept {
- static_assert(is_nothrow_copy_constructible_v<_Tp>);
- static_assert(!__can_use_no_unique_address<_Tp>);
- if (this != std::addressof(__other)) {
- std::destroy_at(std::addressof(__holder_.__val_));
- std::construct_at(std::addressof(__holder_.__val_), __other.__holder_.__val_);
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __movable_box& operator=(__movable_box&& __other) noexcept {
- static_assert(is_nothrow_move_constructible_v<_Tp>);
- static_assert(!__can_use_no_unique_address<_Tp>);
- if (this != std::addressof(__other)) {
- std::destroy_at(std::addressof(__holder_.__val_));
- std::construct_at(std::addressof(__holder_.__val_), std::move(__other.__holder_.__val_));
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const noexcept { return __holder_.__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() noexcept { return __holder_.__val_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { return std::addressof(__holder_.__val_); }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { return std::addressof(__holder_.__val_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const noexcept { return true; }
-};
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_MOVABLE_BOX_H
diff --git a/libcxx/include/__cxx03/__ranges/non_propagating_cache.h b/libcxx/include/__cxx03/__ranges/non_propagating_cache.h
deleted file mode 100644
index 0db1914e592ba..0000000000000
--- a/libcxx/include/__cxx03/__ranges/non_propagating_cache.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_NON_PROPAGATING_CACHE_H
-#define _LIBCPP___CXX03___RANGES_NON_PROPAGATING_CACHE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h> // indirectly_readable
-#include <__cxx03/__iterator/iterator_traits.h> // iter_reference_t
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/optional>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-// __non_propagating_cache is a helper type that allows storing an optional value in it,
-// but which does not copy the source's value when it is copy constructed/assigned to,
-// and which resets the source's value when it is moved-from.
-//
-// This type is used as an implementation detail of some views that need to cache the
-// result of `begin()` in order to provide an amortized O(1) begin() method. Typically,
-// we don't want to propagate the value of the cache upon copy because the cached iterator
-// may refer to internal details of the source view.
-template <class _Tp>
- requires is_object_v<_Tp>
-class _LIBCPP_TEMPLATE_VIS __non_propagating_cache {
- struct __from_tag {};
- struct __forward_tag {};
-
- // This helper class is needed to perform copy and move elision when
- // constructing the contained type from an iterator.
- struct __wrapper {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__forward_tag, _Args&&... __args)
- : __t_(std::forward<_Args>(__args)...) {}
- template <class _Fn>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __wrapper(__from_tag, _Fn const& __f) : __t_(__f()) {}
- _Tp __t_;
- };
-
- optional<__wrapper> __value_ = nullopt;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __non_propagating_cache() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache const&) noexcept
- : __value_(nullopt) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache(__non_propagating_cache&& __other) noexcept
- : __value_(nullopt) {
- __other.__value_.reset();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache const& __other) noexcept {
- if (this != std::addressof(__other)) {
- __value_.reset();
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __non_propagating_cache& operator=(__non_propagating_cache&& __other) noexcept {
- __value_.reset();
- __other.__value_.reset();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() { return __value_->__t_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& operator*() const { return __value_->__t_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool __has_value() const { return __value_.has_value(); }
-
- template <class _Fn>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace_from(_Fn const& __f) {
- return __value_.emplace(__from_tag{}, __f).__t_;
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __emplace(_Args&&... __args) {
- return __value_.emplace(__forward_tag{}, std::forward<_Args>(__args)...).__t_;
- }
-};
-
-struct __empty_cache {};
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_NON_PROPAGATING_CACHE_H
diff --git a/libcxx/include/__cxx03/__ranges/owning_view.h b/libcxx/include/__cxx03/__ranges/owning_view.h
deleted file mode 100644
index 5519d2c795c85..0000000000000
--- a/libcxx/include/__cxx03/__ranges/owning_view.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_OWNING_VIEW_H
-#define _LIBCPP___CXX03___RANGES_OWNING_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/movable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <range _Rp>
- requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
-class owning_view : public view_interface<owning_view<_Rp>> {
- _Rp __r_ = _Rp();
-
-public:
- _LIBCPP_HIDE_FROM_ABI owning_view()
- requires default_initializable<_Rp>
- = default;
- _LIBCPP_HIDE_FROM_ABI constexpr owning_view(_Rp&& __r) : __r_(std::move(__r)) {}
-
- _LIBCPP_HIDE_FROM_ABI owning_view(owning_view&&) = default;
- _LIBCPP_HIDE_FROM_ABI owning_view& operator=(owning_view&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp& base() & noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp& base() const& noexcept { return __r_; }
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp&& base() && noexcept { return std::move(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr const _Rp&& base() const&& noexcept { return std::move(__r_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Rp> begin() { return ranges::begin(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Rp> end() { return ranges::end(__r_); }
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _Rp>
- {
- return ranges::begin(__r_);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _Rp>
- {
- return ranges::end(__r_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
- requires requires { ranges::empty(__r_); }
- {
- return ranges::empty(__r_);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
- requires requires { ranges::empty(__r_); }
- {
- return ranges::empty(__r_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_Rp>
- {
- return ranges::size(__r_);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _Rp>
- {
- return ranges::size(__r_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto data()
- requires contiguous_range<_Rp>
- {
- return ranges::data(__r_);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
- requires contiguous_range<const _Rp>
- {
- return ranges::data(__r_);
- }
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(owning_view);
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_range<_Tp>;
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_OWNING_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/range_adaptor.h b/libcxx/include/__cxx03/__ranges/range_adaptor.h
deleted file mode 100644
index ef08464234b57..0000000000000
--- a/libcxx/include/__cxx03/__ranges/range_adaptor.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_RANGE_ADAPTOR_H
-#define _LIBCPP___CXX03___RANGES_RANGE_ADAPTOR_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/compose.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_class.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-// CRTP base that one can derive from in order to be considered a range adaptor closure
-// by the library. When deriving from this class, a pipe operator will be provided to
-// make the following hold:
-// - `x | f` is equivalent to `f(x)`
-// - `f1 | f2` is an adaptor closure `g` such that `g(x)` is equivalent to `f2(f1(x))`
-template <class _Tp>
- requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
-struct __range_adaptor_closure;
-
-// Type that wraps an arbitrary function object and makes it into a range adaptor closure,
-// i.e. something that can be called via the `x | f` notation.
-template <class _Fn>
-struct __range_adaptor_closure_t : _Fn, __range_adaptor_closure<__range_adaptor_closure_t<_Fn>> {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __range_adaptor_closure_t(_Fn&& __f) : _Fn(std::move(__f)) {}
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__range_adaptor_closure_t);
-
-template <class _Tp>
-_Tp __derived_from_range_adaptor_closure(__range_adaptor_closure<_Tp>*);
-
-template <class _Tp>
-concept _RangeAdaptorClosure = !ranges::range<remove_cvref_t<_Tp>> && requires {
- // Ensure that `remove_cvref_t<_Tp>` is derived from `__range_adaptor_closure<remove_cvref_t<_Tp>>` and isn't derived
- // from `__range_adaptor_closure<U>` for any other type `U`.
- { ranges::__derived_from_range_adaptor_closure((remove_cvref_t<_Tp>*)nullptr) } -> same_as<remove_cvref_t<_Tp>>;
-};
-
-template <ranges::range _Range, _RangeAdaptorClosure _Closure>
- requires invocable<_Closure, _Range>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
-operator|(_Range&& __range, _Closure&& __closure) noexcept(is_nothrow_invocable_v<_Closure, _Range>) {
- return std::invoke(std::forward<_Closure>(__closure), std::forward<_Range>(__range));
-}
-
-template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
- requires constructible_from<decay_t<_Closure>, _Closure> && constructible_from<decay_t<_OtherClosure>, _OtherClosure>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|(_Closure&& __c1, _OtherClosure&& __c2) noexcept(
- is_nothrow_constructible_v<decay_t<_Closure>, _Closure> &&
- is_nothrow_constructible_v<decay_t<_OtherClosure>, _OtherClosure>) {
- return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1)));
-}
-
-template <class _Tp>
- requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
-struct __range_adaptor_closure {};
-
-# if _LIBCPP_STD_VER >= 23
-template <class _Tp>
- requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
-class range_adaptor_closure : public __range_adaptor_closure<_Tp> {};
-# endif // _LIBCPP_STD_VER >= 23
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_RANGE_ADAPTOR_H
diff --git a/libcxx/include/__cxx03/__ranges/rbegin.h b/libcxx/include/__cxx03/__ranges/rbegin.h
deleted file mode 100644
index 8f987319cc4fe..0000000000000
--- a/libcxx/include/__cxx03/__ranges/rbegin.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_RBEGIN_H
-#define _LIBCPP___CXX03___RANGES_RBEGIN_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/auto_cast.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [ranges.access.rbegin]
-
-namespace ranges {
-namespace __rbegin {
-template <class _Tp>
-concept __member_rbegin = __can_borrow<_Tp> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
-};
-
-void rbegin() = delete;
-
-template <class _Tp>
-concept __unqualified_rbegin =
- !__member_rbegin<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(rbegin(__t)) } -> input_or_output_iterator;
- };
-
-template <class _Tp>
-concept __can_reverse =
- __can_borrow<_Tp> && !__member_rbegin<_Tp> && !__unqualified_rbegin<_Tp> && requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
- };
-
-struct __fn {
- template <class _Tp>
- requires __member_rbegin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rbegin()))) {
- return _LIBCPP_AUTO_CAST(__t.rbegin());
- }
-
- template <class _Tp>
- requires __unqualified_rbegin<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rbegin(__t)))) {
- return _LIBCPP_AUTO_CAST(rbegin(__t));
- }
-
- template <class _Tp>
- requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(ranges::end(__t))) {
- return std::make_reverse_iterator(ranges::end(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __rbegin
-
-inline namespace __cpo {
-inline constexpr auto rbegin = __rbegin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.crbegin]
-
-namespace ranges {
-namespace __crbegin {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype(ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t))) {
- return ranges::rbegin(static_cast<const remove_reference_t<_Tp>&>(__t));
- }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rbegin(static_cast<const _Tp&&>(__t))))
- -> decltype(ranges::rbegin(static_cast<const _Tp&&>(__t))) {
- return ranges::rbegin(static_cast<const _Tp&&>(__t));
- }
-};
-} // namespace __crbegin
-
-inline namespace __cpo {
-inline constexpr auto crbegin = __crbegin::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_RBEGIN_H
diff --git a/libcxx/include/__cxx03/__ranges/ref_view.h b/libcxx/include/__cxx03/__ranges/ref_view.h
deleted file mode 100644
index 43c3bebe34dc3..0000000000000
--- a/libcxx/include/__cxx03/__ranges/ref_view.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_REF_VIEW_H
-#define _LIBCPP___CXX03___RANGES_REF_VIEW_H
-
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/different_from.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <range _Range>
- requires is_object_v<_Range>
-class ref_view : public view_interface<ref_view<_Range>> {
- _Range* __range_;
-
- static void __fun(_Range&);
- static void __fun(_Range&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
-
-public:
- template <class _Tp>
- requires __different_from<_Tp, ref_view> && convertible_to<_Tp, _Range&> && requires { __fun(std::declval<_Tp>()); }
- _LIBCPP_HIDE_FROM_ABI constexpr ref_view(_Tp&& __t)
- : __range_(std::addressof(static_cast<_Range&>(std::forward<_Tp>(__t)))) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Range& base() const { return *__range_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Range> begin() const { return ranges::begin(*__range_); }
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Range> end() const { return ranges::end(*__range_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
- requires requires { ranges::empty(*__range_); }
- {
- return ranges::empty(*__range_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<_Range>
- {
- return ranges::size(*__range_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
- requires contiguous_range<_Range>
- {
- return ranges::data(*__range_);
- }
-};
-
-template <class _Range>
-ref_view(_Range&) -> ref_view<_Range>;
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_REF_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/rend.h b/libcxx/include/__cxx03/__ranges/rend.h
deleted file mode 100644
index aa7e4a0ba396a..0000000000000
--- a/libcxx/include/__cxx03/__ranges/rend.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_REND_H
-#define _LIBCPP___CXX03___RANGES_REND_H
-
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/readable_traits.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/rbegin.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/auto_cast.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// [range.access.rend]
-
-namespace ranges {
-namespace __rend {
-template <class _Tp>
-concept __member_rend = __can_borrow<_Tp> && requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
-};
-
-void rend() = delete;
-
-template <class _Tp>
-concept __unqualified_rend =
- !__member_rend<_Tp> && __can_borrow<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- ranges::rbegin(__t);
- { _LIBCPP_AUTO_CAST(rend(__t)) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
- };
-
-template <class _Tp>
-concept __can_reverse = __can_borrow<_Tp> && !__member_rend<_Tp> && !__unqualified_rend<_Tp> && requires(_Tp&& __t) {
- { ranges::begin(__t) } -> same_as<decltype(ranges::end(__t))>;
- { ranges::begin(__t) } -> bidirectional_iterator;
-};
-
-class __fn {
-public:
- template <class _Tp>
- requires __member_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.rend()))) {
- return _LIBCPP_AUTO_CAST(__t.rend());
- }
-
- template <class _Tp>
- requires __unqualified_rend<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(rend(__t)))) {
- return _LIBCPP_AUTO_CAST(rend(__t));
- }
-
- template <class _Tp>
- requires __can_reverse<_Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::begin(__t))) {
- return std::make_reverse_iterator(ranges::begin(__t));
- }
-
- void operator()(auto&&) const = delete;
-};
-} // namespace __rend
-
-inline namespace __cpo {
-inline constexpr auto rend = __rend::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.access.crend]
-
-namespace ranges {
-namespace __crend {
-struct __fn {
- template <class _Tp>
- requires is_lvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))))
- -> decltype(ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t))) {
- return ranges::rend(static_cast<const remove_reference_t<_Tp>&>(__t));
- }
-
- template <class _Tp>
- requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
- noexcept(ranges::rend(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::rend(static_cast<const _Tp&&>(__t))) {
- return ranges::rend(static_cast<const _Tp&&>(__t));
- }
-};
-} // namespace __crend
-
-inline namespace __cpo {
-inline constexpr auto crend = __crend::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_REND_H
diff --git a/libcxx/include/__cxx03/__ranges/repeat_view.h b/libcxx/include/__cxx03/__ranges/repeat_view.h
deleted file mode 100644
index a0cd065b9f2aa..0000000000000
--- a/libcxx/include/__cxx03/__ranges/repeat_view.h
+++ /dev/null
@@ -1,266 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_REPEAT_VIEW_H
-#define _LIBCPP___CXX03___RANGES_REPEAT_VIEW_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__concepts/semiregular.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/unreachable_sentinel.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/iota_view.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/piecewise_construct.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace ranges {
-
-template <class _Tp>
-concept __integer_like_with_usable_difference_type =
- __signed_integer_like<_Tp> || (__integer_like<_Tp> && weakly_incrementable<_Tp>);
-
-template <class _Tp>
-struct __repeat_view_iterator_difference {
- using type = _IotaDiffT<_Tp>;
-};
-
-template <__signed_integer_like _Tp>
-struct __repeat_view_iterator_difference<_Tp> {
- using type = _Tp;
-};
-
-template <class _Tp>
-using __repeat_view_iterator_difference_t = typename __repeat_view_iterator_difference<_Tp>::type;
-
-namespace views::__drop {
-struct __fn;
-} // namespace views::__drop
-
-namespace views::__take {
-struct __fn;
-} // namespace views::__take
-
-template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t>
- requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> &&
- (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>))
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface<repeat_view<_Tp, _Bound>> {
- friend struct views::__take::__fn;
- friend struct views::__drop::__fn;
- class __iterator;
-
-public:
- _LIBCPP_HIDE_FROM_ABI repeat_view()
- requires default_initializable<_Tp>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view(const _Tp& __value, _Bound __bound_sentinel = _Bound())
- requires copy_constructible<_Tp>
- : __value_(in_place, __value), __bound_(__bound_sentinel) {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(__bound_ >= 0, "The value of bound must be greater than or equal to 0");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view(_Tp&& __value, _Bound __bound_sentinel = _Bound())
- : __value_(in_place, std::move(__value)), __bound_(__bound_sentinel) {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(__bound_ >= 0, "The value of bound must be greater than or equal to 0");
- }
-
- template <class... _TpArgs, class... _BoundArgs>
- requires(constructible_from<_Tp, _TpArgs...> && constructible_from<_Bound, _BoundArgs...>)
- _LIBCPP_HIDE_FROM_ABI constexpr explicit repeat_view(
- piecewise_construct_t, tuple<_TpArgs...> __value_args, tuple<_BoundArgs...> __bound_args = tuple<>{})
- : __value_(in_place, std::make_from_tuple<_Tp>(std::move(__value_args))),
- __bound_(std::make_from_tuple<_Bound>(std::move(__bound_args))) {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __bound_ >= 0, "The behavior is undefined if Bound is not unreachable_sentinel_t and bound is negative");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() const { return __iterator(std::addressof(*__value_)); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator end() const
- requires(!same_as<_Bound, unreachable_sentinel_t>)
- {
- return __iterator(std::addressof(*__value_), __bound_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr unreachable_sentinel_t end() const noexcept { return unreachable_sentinel; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires(!same_as<_Bound, unreachable_sentinel_t>)
- {
- return std::__to_unsigned_like(__bound_);
- }
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_;
- _LIBCPP_NO_UNIQUE_ADDRESS _Bound __bound_ = _Bound();
-};
-
-template <class _Tp, class _Bound = unreachable_sentinel_t>
-repeat_view(_Tp, _Bound = _Bound()) -> repeat_view<_Tp, _Bound>;
-
-// [range.repeat.iterator]
-template <move_constructible _Tp, semiregular _Bound>
- requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> &&
- (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>))
-class repeat_view<_Tp, _Bound>::__iterator {
- friend class repeat_view;
-
- using _IndexT = conditional_t<same_as<_Bound, unreachable_sentinel_t>, ptrdiff_t, _Bound>;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(const _Tp* __value, _IndexT __bound_sentinel = _IndexT())
- : __value_(__value), __current_(__bound_sentinel) {}
-
-public:
- using iterator_concept = random_access_iterator_tag;
- using iterator_category = random_access_iterator_tag;
- using value_type = _Tp;
- using difference_type = __repeat_view_iterator_difference_t<_IndexT>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const noexcept { return *__value_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- ++__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(__current_ > 0, "The value of bound must be greater than or equal to 0");
- --__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(__current_ + __n >= 0, "The value of bound must be greater than or equal to 0");
- __current_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) {
- if constexpr (!same_as<_Bound, unreachable_sentinel_t>)
- _LIBCPP_ASSERT_UNCATEGORIZED(__current_ - __n >= 0, "The value of bound must be greater than or equal to 0");
- __current_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](difference_type __n) const noexcept { return *(*this + __n); }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) {
- return __x.__current_ <=> __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n) {
- __i += __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i) {
- __i += __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n) {
- __i -= __n;
- return __i;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) {
- return static_cast<difference_type>(__x.__current_) - static_cast<difference_type>(__y.__current_);
- }
-
-private:
- const _Tp* __value_ = nullptr;
- _IndexT __current_ = _IndexT();
-};
-
-// clang-format off
-namespace views {
-namespace __repeat {
-struct __fn {
- template <class _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Tp&& __value)
- noexcept(noexcept(ranges::repeat_view<decay_t<_Tp>>(std::forward<_Tp>(__value))))
- -> decltype( ranges::repeat_view<decay_t<_Tp>>(std::forward<_Tp>(__value)))
- { return ranges::repeat_view<decay_t<_Tp>>(std::forward<_Tp>(__value)); }
-
- template <class _Tp, class _Bound>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Tp&& __value, _Bound&& __bound_sentinel)
- noexcept(noexcept(ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel))))
- -> decltype( ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel)))
- { return ranges::repeat_view(std::forward<_Tp>(__value), std::forward<_Bound>(__bound_sentinel)); }
-};
-} // namespace __repeat
-// clang-format on
-
-inline namespace __cpo {
-inline constexpr auto repeat = __repeat::__fn{};
-} // namespace __cpo
-} // namespace views
-
-template <class _Tp>
-inline constexpr bool __is_repeat_specialization = false;
-
-template <class _Tp, class _Bound>
-inline constexpr bool __is_repeat_specialization<repeat_view<_Tp, _Bound>> = true;
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_REPEAT_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/reverse_view.h b/libcxx/include/__cxx03/__ranges/reverse_view.h
deleted file mode 100644
index 53a0e9d213c5b..0000000000000
--- a/libcxx/include/__cxx03/__ranges/reverse_view.h
+++ /dev/null
@@ -1,203 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_REVERSE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_REVERSE_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/next.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <view _View>
- requires bidirectional_range<_View>
-class reverse_view : public view_interface<reverse_view<_View>> {
- // We cache begin() whenever ranges::next is not guaranteed O(1) to provide an
- // amortized O(1) begin() method.
- static constexpr bool _UseCache = !random_access_range<_View> && !common_range<_View>;
- using _Cache = _If<_UseCache, __non_propagating_cache<reverse_iterator<iterator_t<_View>>>, __empty_cache>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache();
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI reverse_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() {
- if constexpr (_UseCache)
- if (__cached_begin_.__has_value())
- return *__cached_begin_;
-
- auto __tmp = std::make_reverse_iterator(ranges::next(ranges::begin(__base_), ranges::end(__base_)));
- if constexpr (_UseCache)
- __cached_begin_.__emplace(__tmp);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin()
- requires common_range<_View>
- {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires common_range<const _View>
- {
- return std::make_reverse_iterator(ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires common_range<const _View>
- {
- return std::make_reverse_iterator(ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return ranges::size(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return ranges::size(__base_);
- }
-};
-
-template <class _Range>
-reverse_view(_Range&&) -> reverse_view<views::all_t<_Range>>;
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<reverse_view<_Tp>> = enable_borrowed_range<_Tp>;
-
-namespace views {
-namespace __reverse {
-template <class _Tp>
-inline constexpr bool __is_reverse_view = false;
-
-template <class _Tp>
-inline constexpr bool __is_reverse_view<reverse_view<_Tp>> = true;
-
-template <class _Tp>
-inline constexpr bool __is_sized_reverse_subrange = false;
-
-template <class _Iter>
-inline constexpr bool
- __is_sized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, subrange_kind::sized>> =
- true;
-
-template <class _Tp>
-inline constexpr bool __is_unsized_reverse_subrange = false;
-
-template <class _Iter, subrange_kind _Kind>
-inline constexpr bool __is_unsized_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> =
- _Kind == subrange_kind::unsized;
-
-template <class _Tp>
-struct __unwrapped_reverse_subrange {
- using type =
- void; // avoid SFINAE-ing out the overload below -- let the concept requirements do it for better diagnostics
-};
-
-template <class _Iter, subrange_kind _Kind>
-struct __unwrapped_reverse_subrange<subrange<reverse_iterator<_Iter>, reverse_iterator<_Iter>, _Kind>> {
- using type = subrange<_Iter, _Iter, _Kind>;
-};
-
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Range>
- requires __is_reverse_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(std::forward<_Range>(__range).base())) -> decltype(std::forward<_Range>(__range).base()) {
- return std::forward<_Range>(__range).base();
- }
-
- template <class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_sized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())))
- -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size())) {
- return _UnwrappedSubrange(__range.end().base(), __range.begin().base(), __range.size());
- }
-
- template <class _Range,
- class _UnwrappedSubrange = typename __unwrapped_reverse_subrange<remove_cvref_t<_Range>>::type>
- requires __is_unsized_reverse_subrange<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(_UnwrappedSubrange(__range.end().base(), __range.begin().base())))
- -> decltype(_UnwrappedSubrange(__range.end().base(), __range.begin().base())) {
- return _UnwrappedSubrange(__range.end().base(), __range.begin().base());
- }
-
- template <class _Range>
- requires(!__is_reverse_view<remove_cvref_t<_Range>> && !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
- !__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(reverse_view{
- std::forward<_Range>(__range)})) -> decltype(reverse_view{std::forward<_Range>(__range)}) {
- return reverse_view{std::forward<_Range>(__range)};
- }
-};
-} // namespace __reverse
-
-inline namespace __cpo {
-inline constexpr auto reverse = __reverse::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_REVERSE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/single_view.h b/libcxx/include/__cxx03/__ranges/single_view.h
deleted file mode 100644
index 3e43302f213b1..0000000000000
--- a/libcxx/include/__cxx03/__ranges/single_view.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_SINGLE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_SINGLE_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-# if _LIBCPP_STD_VER >= 23
-template <move_constructible _Tp>
-# else
-template <copy_constructible _Tp>
-# endif
- requires is_object_v<_Tp>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface<single_view<_Tp>> {
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI single_view()
- requires default_initializable<_Tp>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(const _Tp& __t)
-# if _LIBCPP_STD_VER >= 23
- requires copy_constructible<_Tp>
-# endif
- : __value_(in_place, __t) {
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(_Tp&& __t) : __value_(in_place, std::move(__t)) {}
-
- template <class... _Args>
- requires constructible_from<_Tp, _Args...>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit single_view(in_place_t, _Args&&... __args)
- : __value_{in_place, std::forward<_Args>(__args)...} {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* begin() noexcept { return data(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* begin() const noexcept { return data(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* end() noexcept { return data() + 1; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* end() const noexcept { return data() + 1; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool empty() noexcept { return false; }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t size() noexcept { return 1; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data() noexcept { return __value_.operator->(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* data() const noexcept { return __value_.operator->(); }
-};
-
-template <class _Tp>
-single_view(_Tp) -> single_view<_Tp>;
-
-namespace views {
-namespace __single_view {
-
-struct __fn : __range_adaptor_closure<__fn> {
- template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))))
- -> decltype(single_view<decay_t<_Range&&>>(std::forward<_Range>(__range))) {
- return single_view<decay_t<_Range&&>>(std::forward<_Range>(__range));
- }
-};
-} // namespace __single_view
-
-inline namespace __cpo {
-inline constexpr auto single = __single_view::__fn{};
-} // namespace __cpo
-
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_SINGLE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/size.h b/libcxx/include/__cxx03/__ranges/size.h
deleted file mode 100644
index f311f76df15cc..0000000000000
--- a/libcxx/include/__cxx03/__ranges/size.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_SIZE_H
-#define _LIBCPP___CXX03___RANGES_SIZE_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__concepts/class_or_enum.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/make_signed.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/auto_cast.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class>
-inline constexpr bool disable_sized_range = false;
-} // namespace ranges
-
-// [range.prim.size]
-
-namespace ranges {
-namespace __size {
-void size() = delete;
-
-template <class _Tp>
-concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
-
-template <class _Tp>
-concept __member_size = __size_enabled<_Tp> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
-};
-
-template <class _Tp>
-concept __unqualified_size =
- __size_enabled<_Tp> && !__member_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like;
- };
-
-template <class _Tp>
-concept __difference =
- !__member_size<_Tp> && !__unqualified_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) {
- { ranges::begin(__t) } -> forward_iterator;
- { ranges::end(__t) } -> sized_sentinel_for<decltype(ranges::begin(std::declval<_Tp>()))>;
- };
-
-struct __fn {
- // `[range.prim.size]`: the array case (for rvalues).
- template <class _Tp, size_t _Sz>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&&)[_Sz]) const noexcept {
- return _Sz;
- }
-
- // `[range.prim.size]`: the array case (for lvalues).
- template <class _Tp, size_t _Sz>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t operator()(_Tp (&)[_Sz]) const noexcept {
- return _Sz;
- }
-
- // `[range.prim.size]`: `auto(t.size())` is a valid expression.
- template <__member_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.size()))) {
- return _LIBCPP_AUTO_CAST(__t.size());
- }
-
- // `[range.prim.size]`: `auto(size(t))` is a valid expression.
- template <__unqualified_size _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(size(__t)))) {
- return _LIBCPP_AUTO_CAST(size(__t));
- }
-
- // [range.prim.size]: the `to-unsigned-like` case.
- template <__difference _Tp>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))))
- -> decltype(std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t))) {
- return std::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t));
- }
-};
-
-} // namespace __size
-
-inline namespace __cpo {
-inline constexpr auto size = __size::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-// [range.prim.ssize]
-
-namespace ranges {
-namespace __ssize {
-struct __fn {
- template <class _Tp>
- requires requires(_Tp&& __t) { ranges::size(__t); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr integral auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::size(__t))) {
- using _Signed = make_signed_t<decltype(ranges::size(__t))>;
- if constexpr (sizeof(ptrdiff_t) > sizeof(_Signed))
- return static_cast<ptrdiff_t>(ranges::size(__t));
- else
- return static_cast<_Signed>(ranges::size(__t));
- }
-};
-} // namespace __ssize
-
-inline namespace __cpo {
-inline constexpr auto ssize = __ssize::__fn{};
-} // namespace __cpo
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_SIZE_H
diff --git a/libcxx/include/__cxx03/__ranges/split_view.h b/libcxx/include/__cxx03/__ranges/split_view.h
deleted file mode 100644
index 76ab9f485bd7c..0000000000000
--- a/libcxx/include/__cxx03/__ranges/split_view.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_SPLIT_VIEW_H
-#define _LIBCPP___CXX03___RANGES_SPLIT_VIEW_H
-
-#include <__cxx03/__algorithm/ranges_search.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/ranges_operations.h>
-#include <__cxx03/__iterator/indirectly_comparable.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/non_propagating_cache.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/single_view.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <forward_range _View, forward_range _Pattern>
- requires view<_View> && view<_Pattern> &&
- indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to>
-class split_view : public view_interface<split_view<_View, _Pattern>> {
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS _Pattern __pattern_ = _Pattern();
- using _Cache = __non_propagating_cache<subrange<iterator_t<_View>>>;
- _Cache __cached_begin_ = _Cache();
-
- template <class, class>
- friend struct __iterator;
-
- template <class, class>
- friend struct __sentinel;
-
- struct __iterator;
- struct __sentinel;
-
- _LIBCPP_HIDE_FROM_ABI constexpr subrange<iterator_t<_View>> __find_next(iterator_t<_View> __it) {
- auto [__begin, __end] = ranges::search(subrange(__it, ranges::end(__base_)), __pattern_);
- if (__begin != ranges::end(__base_) && ranges::empty(__pattern_)) {
- ++__begin;
- ++__end;
- }
- return {__begin, __end};
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI split_view()
- requires default_initializable<_View> && default_initializable<_Pattern>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern)
- : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {}
-
- template <forward_range _Range>
- requires constructible_from<_View, views::all_t<_Range>> &&
- constructible_from<_Pattern, single_view<range_value_t<_Range>>>
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
- split_view(_Range&& __range, range_value_t<_Range> __elem)
- : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
- if (!__cached_begin_.__has_value()) {
- __cached_begin_.__emplace(__find_next(ranges::begin(__base_)));
- }
- return {*this, ranges::begin(__base_), *__cached_begin_};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
- if constexpr (common_range<_View>) {
- return __iterator{*this, ranges::end(__base_), {}};
- } else {
- return __sentinel{*this};
- }
- }
-};
-
-template <class _Range, class _Pattern>
-split_view(_Range&&, _Pattern&&) -> split_view<views::all_t<_Range>, views::all_t<_Pattern>>;
-
-template <forward_range _Range>
-split_view(_Range&&, range_value_t<_Range>) -> split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
-
-template <forward_range _View, forward_range _Pattern>
- requires view<_View> && view<_Pattern> &&
- indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to>
-struct split_view<_View, _Pattern>::__iterator {
-private:
- split_view* __parent_ = nullptr;
- _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __cur_ = iterator_t<_View>();
- _LIBCPP_NO_UNIQUE_ADDRESS subrange<iterator_t<_View>> __next_ = subrange<iterator_t<_View>>();
- bool __trailing_empty_ = false;
-
- friend struct __sentinel;
-
-public:
- using iterator_concept = forward_iterator_tag;
- using iterator_category = input_iterator_tag;
- using value_type = subrange<iterator_t<_View>>;
- using difference_type = range_difference_t<_View>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(
- split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next)
- : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- __cur_ = __next_.begin();
- if (__cur_ != ranges::end(__parent_->__base_)) {
- __cur_ = __next_.end();
- if (__cur_ == ranges::end(__parent_->__base_)) {
- __trailing_empty_ = true;
- __next_ = {__cur_, __cur_};
- } else {
- __next_ = __parent_->__find_next(__cur_);
- }
- } else {
- __trailing_empty_ = false;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
- return __x.__cur_ == __y.__cur_ && __x.__trailing_empty_ == __y.__trailing_empty_;
- }
-};
-
-template <forward_range _View, forward_range _Pattern>
- requires view<_View> && view<_Pattern> &&
- indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to>
-struct split_view<_View, _Pattern>::__sentinel {
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_View> __end_ = sentinel_t<_View>();
-
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __equals(const __iterator& __x, const __sentinel& __y) {
- return __x.__cur_ == __y.__end_ && !__x.__trailing_empty_;
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(split_view<_View, _Pattern>& __parent)
- : __end_(ranges::end(__parent.__base_)) {}
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) {
- return __equals(__x, __y);
- }
-};
-
-namespace views {
-namespace __split_view {
-struct __fn {
- // clang-format off
- template <class _Range, class _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __range, _Pattern&& __pattern) const
- noexcept(noexcept(split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern))))
- -> decltype( split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)))
- { return split_view(std::forward<_Range>(__range), std::forward<_Pattern>(__pattern)); }
- // clang-format on
-
- template <class _Pattern>
- requires constructible_from<decay_t<_Pattern>, _Pattern>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pattern&& __pattern) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pattern>, _Pattern>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pattern>(__pattern)));
- }
-};
-} // namespace __split_view
-
-inline namespace __cpo {
-inline constexpr auto split = __split_view::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_SPLIT_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/subrange.h b/libcxx/include/__cxx03/__ranges/subrange.h
deleted file mode 100644
index e077d221ed202..0000000000000
--- a/libcxx/include/__cxx03/__ranges/subrange.h
+++ /dev/null
@@ -1,273 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_SUBRANGE_H
-#define _LIBCPP___CXX03___RANGES_SUBRANGE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/different_from.h>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/subrange.h>
-#include <__cxx03/__iterator/advance.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/dangling.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__tuple/tuple_element.h>
-#include <__cxx03/__tuple/tuple_like_no_subrange.h>
-#include <__cxx03/__tuple/tuple_size.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-template <class _From, class _To>
-concept __uses_nonqualification_pointer_conversion =
- is_pointer_v<_From> && is_pointer_v<_To> &&
- !convertible_to<remove_pointer_t<_From> (*)[], remove_pointer_t<_To> (*)[]>;
-
-template <class _From, class _To>
-concept __convertible_to_non_slicing =
- convertible_to<_From, _To> && !__uses_nonqualification_pointer_conversion<decay_t<_From>, decay_t<_To>>;
-
-template <class _Pair, class _Iter, class _Sent>
-concept __pair_like_convertible_from =
- !range<_Pair> && __pair_like_no_subrange<_Pair> && constructible_from<_Pair, _Iter, _Sent> &&
- __convertible_to_non_slicing<_Iter, tuple_element_t<0, _Pair>> && convertible_to<_Sent, tuple_element_t<1, _Pair>>;
-
-template <input_or_output_iterator _Iter,
- sentinel_for<_Iter> _Sent = _Iter,
- subrange_kind _Kind = sized_sentinel_for<_Sent, _Iter> ? subrange_kind::sized : subrange_kind::unsized>
- requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>)
-class _LIBCPP_TEMPLATE_VIS subrange : public view_interface<subrange<_Iter, _Sent, _Kind>> {
-public:
- // Note: this is an internal implementation detail that is public only for internal usage.
- static constexpr bool _StoreSize = (_Kind == subrange_kind::sized && !sized_sentinel_for<_Sent, _Iter>);
-
-private:
- static constexpr bool _MustProvideSizeAtConstruction = !_StoreSize; // just to improve compiler diagnostics
- struct _Empty {
- _LIBCPP_HIDE_FROM_ABI constexpr _Empty(auto) noexcept {}
- };
- using _Size = conditional_t<_StoreSize, make_unsigned_t<iter_difference_t<_Iter>>, _Empty>;
- _LIBCPP_NO_UNIQUE_ADDRESS _Iter __begin_ = _Iter();
- _LIBCPP_NO_UNIQUE_ADDRESS _Sent __end_ = _Sent();
- _LIBCPP_NO_UNIQUE_ADDRESS _Size __size_ = 0;
-
-public:
- _LIBCPP_HIDE_FROM_ABI subrange()
- requires default_initializable<_Iter>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr subrange(__convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent)
- requires _MustProvideSizeAtConstruction
- : __begin_(std::move(__iter)), __end_(std::move(__sent)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr subrange(
- __convertible_to_non_slicing<_Iter> auto __iter, _Sent __sent, make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires(_Kind == subrange_kind::sized)
- : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) {
- if constexpr (sized_sentinel_for<_Sent, _Iter>)
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS((__end_ - __begin_) == static_cast<iter_difference_t<_Iter>>(__n),
- "std::ranges::subrange was passed an invalid size hint");
- }
-
- template <__different_from<subrange> _Range>
- requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
- requires(!_StoreSize)
- : subrange(ranges::begin(__range), ranges::end(__range)) {}
-
- template <__different_from<subrange> _Range>
- requires borrowed_range<_Range> && __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range)
- requires _StoreSize && sized_range<_Range>
- : subrange(__range, ranges::size(__range)) {}
-
- template <borrowed_range _Range>
- requires __convertible_to_non_slicing<iterator_t<_Range>, _Iter> &&
- convertible_to<sentinel_t<_Range>, _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr subrange(_Range&& __range, make_unsigned_t<iter_difference_t<_Iter>> __n)
- requires(_Kind == subrange_kind::sized)
- : subrange(ranges::begin(__range), ranges::end(__range), __n) {}
-
- template <__pair_like_convertible_from<const _Iter&, const _Sent&> _Pair>
- _LIBCPP_HIDE_FROM_ABI constexpr operator _Pair() const {
- return _Pair(__begin_, __end_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const
- requires copyable<_Iter>
- {
- return __begin_;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin()
- requires(!copyable<_Iter>)
- {
- return std::move(__begin_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
- requires(_Kind == subrange_kind::sized)
- {
- if constexpr (_StoreSize)
- return __size_;
- else
- return std::__to_unsigned_like(__end_ - __begin_);
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) const&
- requires forward_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(__n);
- return __tmp;
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange next(iter_difference_t<_Iter> __n = 1) && {
- advance(__n);
- return std::move(*this);
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange prev(iter_difference_t<_Iter> __n = 1) const
- requires bidirectional_iterator<_Iter>
- {
- auto __tmp = *this;
- __tmp.advance(-__n);
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr subrange& advance(iter_difference_t<_Iter> __n) {
- if constexpr (bidirectional_iterator<_Iter>) {
- if (__n < 0) {
- ranges::advance(__begin_, __n);
- if constexpr (_StoreSize)
- __size_ += std::__to_unsigned_like(-__n);
- return *this;
- }
- }
-
- auto __d = __n - ranges::advance(__begin_, __n, __end_);
- if constexpr (_StoreSize)
- __size_ -= std::__to_unsigned_like(__d);
- return *this;
- }
-};
-
-template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
-subrange(_Iter, _Sent) -> subrange<_Iter, _Sent>;
-
-template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
-subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>;
-
-template <borrowed_range _Range>
-subrange(_Range&&) -> subrange<iterator_t<_Range>,
- sentinel_t<_Range>,
- (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
- ? subrange_kind::sized
- : subrange_kind::unsized>;
-
-template <borrowed_range _Range>
-subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
- -> subrange<iterator_t<_Range>, sentinel_t<_Range>, subrange_kind::sized>;
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
-}
-
-template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
- requires(_Index < 2)
-_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
- if constexpr (_Index == 0)
- return __subrange.begin();
- else
- return __subrange.end();
-}
-
-template <class _Ip, class _Sp, subrange_kind _Kp>
-inline constexpr bool enable_borrowed_range<subrange<_Ip, _Sp, _Kp>> = true;
-
-template <range _Rp>
-using borrowed_subrange_t = _If<borrowed_range<_Rp>, subrange<iterator_t<_Rp>>, dangling>;
-} // namespace ranges
-
-// [range.subrange.general]
-
-using ranges::get;
-
-// [ranges.syn]
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_size<ranges::subrange<_Ip, _Sp, _Kp>> : integral_constant<size_t, 2> {};
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<0, ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Ip;
-};
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<1, ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Sp;
-};
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<0, const ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Ip;
-};
-
-template <class _Ip, class _Sp, ranges::subrange_kind _Kp>
-struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> {
- using type = _Sp;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_SUBRANGE_H
diff --git a/libcxx/include/__cxx03/__ranges/take_view.h b/libcxx/include/__cxx03/__ranges/take_view.h
deleted file mode 100644
index d3cadd55ae1c1..0000000000000
--- a/libcxx/include/__cxx03/__ranges/take_view.h
+++ /dev/null
@@ -1,369 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_TAKE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_TAKE_VIEW_H
-
-#include <__cxx03/__algorithm/min.h>
-#include <__cxx03/__algorithm/ranges_min.h>
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__fwd/span.h>
-#include <__cxx03/__fwd/string_view.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/counted_iterator.h>
-#include <__cxx03/__iterator/default_sentinel.h>
-#include <__cxx03/__iterator/distance.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty_view.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/iota_view.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/repeat_view.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/subrange.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/auto_cast.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <view _View>
-class take_view : public view_interface<take_view<_View>> {
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- range_difference_t<_View> __count_ = 0;
-
- template <bool>
- class __sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI take_view()
- requires default_initializable<_View>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
- take_view(_View __base, range_difference_t<_View> __count)
- : __base_(std::move(__base)), __count_(__count) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!__simple_view<_View>)
- {
- if constexpr (sized_range<_View>) {
- if constexpr (random_access_range<_View>) {
- return ranges::begin(__base_);
- } else {
- using _DifferenceT = range_difference_t<_View>;
- auto __size = size();
- return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
- }
- } else {
- return counted_iterator(ranges::begin(__base_), __count_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _View>
- {
- if constexpr (sized_range<const _View>) {
- if constexpr (random_access_range<const _View>) {
- return ranges::begin(__base_);
- } else {
- using _DifferenceT = range_difference_t<const _View>;
- auto __size = size();
- return counted_iterator(ranges::begin(__base_), static_cast<_DifferenceT>(__size));
- }
- } else {
- return counted_iterator(ranges::begin(__base_), __count_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View>)
- {
- if constexpr (sized_range<_View>) {
- if constexpr (random_access_range<_View>) {
- return ranges::begin(__base_) + size();
- } else {
- return default_sentinel;
- }
- } else {
- return __sentinel<false>{ranges::end(__base_)};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View>
- {
- if constexpr (sized_range<const _View>) {
- if constexpr (random_access_range<const _View>) {
- return ranges::begin(__base_) + size();
- } else {
- return default_sentinel;
- }
- } else {
- return __sentinel<true>{ranges::end(__base_)};
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- auto __n = ranges::size(__base_);
- return ranges::min(__n, static_cast<decltype(__n)>(__count_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- auto __n = ranges::size(__base_);
- return ranges::min(__n, static_cast<decltype(__n)>(__count_));
- }
-};
-
-template <view _View>
-template <bool _Const>
-class take_view<_View>::__sentinel {
- using _Base = __maybe_const<_Const, _View>;
- template <bool _OtherConst>
- using _Iter = counted_iterator<iterator_t<__maybe_const<_OtherConst, _View>>>;
- _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- template <bool>
- friend class take_view<_View>::__sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_Const>& __lhs, const __sentinel& __rhs) {
- return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
- }
-
- template <bool _OtherConst = !_Const>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const _Iter<_OtherConst>& __lhs, const __sentinel& __rhs) {
- return __lhs.count() == 0 || __lhs.base() == __rhs.__end_;
- }
-};
-
-template <class _Range>
-take_view(_Range&&, range_difference_t<_Range>) -> take_view<views::all_t<_Range>>;
-
-template <class _Tp>
-inline constexpr bool enable_borrowed_range<take_view<_Tp>> = enable_borrowed_range<_Tp>;
-
-namespace views {
-namespace __take {
-
-template <class _Tp>
-inline constexpr bool __is_empty_view = false;
-
-template <class _Tp>
-inline constexpr bool __is_empty_view<empty_view<_Tp>> = true;
-
-template <class _Tp>
-inline constexpr bool __is_passthrough_specialization = false;
-
-template <class _Tp, size_t _Extent>
-inline constexpr bool __is_passthrough_specialization<span<_Tp, _Extent>> = true;
-
-template <class _CharT, class _Traits>
-inline constexpr bool __is_passthrough_specialization<basic_string_view<_CharT, _Traits>> = true;
-
-template <class _Iter, class _Sent, subrange_kind _Kind>
-inline constexpr bool __is_passthrough_specialization<subrange<_Iter, _Sent, _Kind>> = true;
-
-template <class _Tp>
-inline constexpr bool __is_iota_specialization = false;
-
-template <class _Np, class _Bound>
-inline constexpr bool __is_iota_specialization<iota_view<_Np, _Bound>> = true;
-
-template <class _Tp>
-struct __passthrough_type;
-
-template <class _Tp, size_t _Extent>
-struct __passthrough_type<span<_Tp, _Extent>> {
- using type = span<_Tp>;
-};
-
-template <class _CharT, class _Traits>
-struct __passthrough_type<basic_string_view<_CharT, _Traits>> {
- using type = basic_string_view<_CharT, _Traits>;
-};
-
-template <class _Iter, class _Sent, subrange_kind _Kind>
- requires requires { typename subrange<_Iter>; }
-struct __passthrough_type<subrange<_Iter, _Sent, _Kind>> {
- using type = subrange<_Iter>;
-};
-
-template <class _Tp>
-using __passthrough_type_t = typename __passthrough_type<_Tp>::type;
-
-struct __fn {
- // [range.take.overview]: the `empty_view` case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np>
- requires __is_empty_view<remove_cvref_t<_Range>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&&) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))))
- -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Range>(__range))) {
- return _LIBCPP_AUTO_CAST(std::forward<_Range>(__range));
- }
-
- // [range.take.overview]: the `span | basic_string_view | subrange` case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires(!__is_empty_view<_RawRange> && random_access_range<_RawRange> && sized_range<_RawRange> &&
- __is_passthrough_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
- operator()(_Range&& __rng, _Np&& __n) const noexcept(noexcept(__passthrough_type_t<_RawRange>(
- ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))))
- -> decltype(__passthrough_type_t<_RawRange>(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- ranges::begin(__rng),
- ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))) {
- return __passthrough_type_t<_RawRange>(
- ranges::begin(__rng), ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)));
- }
-
- // [range.take.overview]: the `iota_view` case.
- // clang-format off
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires (!__is_empty_view<_RawRange> &&
- random_access_range<_RawRange> &&
- sized_range<_RawRange> &&
- __is_iota_specialization<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
- constexpr auto operator()(_Range&& __rng, _Np&& __n) const
- noexcept(noexcept(ranges::iota_view(
- *ranges::begin(__rng),
- *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- )))
- -> decltype( ranges::iota_view(
- // Note: deliberately not forwarding `__rng` to guard against double moves.
- *ranges::begin(__rng),
- *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- ))
- { return ranges::iota_view(
- *ranges::begin(__rng),
- *(ranges::begin(__rng) + std::min<_Dist>(ranges::distance(__rng), std::forward<_Np>(__n)))
- ); }
-
-#if _LIBCPP_STD_VER >= 23
- // [range.take.overview]: the `repeat_view` "_RawRange models sized_range" case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires(__is_repeat_specialization<_RawRange> && sized_range<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n)))))
- -> decltype( views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))))
- { return views::repeat(*__range.__value_, std::min<_Dist>(ranges::distance(__range), std::forward<_Np>(__n))); }
-
- // [range.take.overview]: the `repeat_view` "otherwise" case.
- template <class _Range,
- convertible_to<range_difference_t<_Range>> _Np,
- class _RawRange = remove_cvref_t<_Range>,
- class _Dist = range_difference_t<_Range>>
- requires(__is_repeat_specialization<_RawRange> && !sized_range<_RawRange>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(views::repeat(*__range.__value_, static_cast<_Dist>(__n))))
- -> decltype( views::repeat(*__range.__value_, static_cast<_Dist>(__n)))
- { return views::repeat(*__range.__value_, static_cast<_Dist>(__n)); }
-#endif
- // clang-format on
-
- // [range.take.overview]: the "otherwise" case.
- template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
- // Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
- // overloads.
- requires(!(__is_empty_view<_RawRange> ||
-# if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
-# endif
- (__is_iota_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> &&
- random_access_range<_RawRange>)))
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
- noexcept(noexcept(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
- -> decltype(take_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
- return take_view(std::forward<_Range>(__range), std::forward<_Np>(__n));
- }
-
- template <class _Np>
- requires constructible_from<decay_t<_Np>, _Np>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const
- noexcept(is_nothrow_constructible_v<decay_t<_Np>, _Np>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Np>(__n)));
- }
-};
-
-} // namespace __take
-
-inline namespace __cpo {
-inline constexpr auto take = __take::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_TAKE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/take_while_view.h b/libcxx/include/__cxx03/__ranges/take_while_view.h
deleted file mode 100644
index 7dec8490e0754..0000000000000
--- a/libcxx/include/__cxx03/__ranges/take_while_view.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_TAKE_WHILE_VIEW_H
-#define _LIBCPP___CXX03___RANGES_TAKE_WHILE_VIEW_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <view _View, class _Pred>
- requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interface<take_while_view<_View, _Pred>> {
- template <bool>
- class __sentinel;
-
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI take_while_view()
- requires default_initializable<_View> && default_initializable<_Pred>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred)
- : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!__simple_view<_View>)
- {
- return ranges::begin(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>
- {
- return ranges::begin(__base_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!__simple_view<_View>)
- {
- return __sentinel</*_Const=*/false>(ranges::end(__base_), std::addressof(*__pred_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>
- {
- return __sentinel</*_Const=*/true>(ranges::end(__base_), std::addressof(*__pred_));
- }
-};
-
-template <class _Range, class _Pred>
-take_while_view(_Range&&, _Pred) -> take_while_view<views::all_t<_Range>, _Pred>;
-
-template <view _View, class _Pred>
- requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
-template <bool _Const>
-class take_while_view<_View, _Pred>::__sentinel {
- using _Base = __maybe_const<_Const, _View>;
-
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
- const _Pred* __pred_ = nullptr;
-
- friend class __sentinel<!_Const>;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end, const _Pred* __pred)
- : __end_(std::move(__end)), __pred_(__pred) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) {
- return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x);
- }
-
- template <bool _OtherConst = !_Const>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __sentinel& __y) {
- return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x);
- }
-};
-
-namespace views {
-namespace __take_while {
-
-struct __fn {
- template <class _Range, class _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Pred&& __pred) const
- noexcept(noexcept(/**/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))))
- -> decltype(/*--*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred))) {
- return /*-------------*/ take_while_view(std::forward<_Range>(__range), std::forward<_Pred>(__pred));
- }
-
- template <class _Pred>
- requires constructible_from<decay_t<_Pred>, _Pred>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Pred&& __pred) const
- noexcept(is_nothrow_constructible_v<decay_t<_Pred>, _Pred>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Pred>(__pred)));
- }
-};
-
-} // namespace __take_while
-
-inline namespace __cpo {
-inline constexpr auto take_while = __take_while::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_TAKE_WHILE_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/to.h b/libcxx/include/__cxx03/__ranges/to.h
deleted file mode 100644
index f50f43cccc53a..0000000000000
--- a/libcxx/include/__cxx03/__ranges/to.h
+++ /dev/null
@@ -1,245 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_TO_H
-#define _LIBCPP___CXX03___RANGES_TO_H
-
-#include <__cxx03/__algorithm/ranges_copy.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/insert_iterator.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/ref_view.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/transform_view.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/is_volatile.h>
-#include <__cxx03/__type_traits/type_identity.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace ranges {
-
-template <class _Container>
-constexpr bool __reservable_container =
- sized_range<_Container> && requires(_Container& __c, range_size_t<_Container> __n) {
- __c.reserve(__n);
- { __c.capacity() } -> same_as<decltype(__n)>;
- { __c.max_size() } -> same_as<decltype(__n)>;
- };
-
-template <class _Container, class _Ref>
-constexpr bool __container_insertable = requires(_Container& __c, _Ref&& __ref) {
- requires(
- requires { __c.push_back(std::forward<_Ref>(__ref)); } ||
- requires { __c.insert(__c.end(), std::forward<_Ref>(__ref)); });
-};
-
-template <class _Ref, class _Container>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __container_inserter(_Container& __c) {
- if constexpr (requires { __c.push_back(std::declval<_Ref>()); }) {
- return std::back_inserter(__c);
- } else {
- return std::inserter(__c, __c.end());
- }
-}
-
-// Note: making this a concept allows short-circuiting the second condition.
-template <class _Container, class _Range>
-concept __try_non_recursive_conversion =
- !input_range<_Container> || convertible_to<range_reference_t<_Range>, range_value_t<_Container>>;
-
-template <class _Container, class _Range, class... _Args>
-concept __constructible_from_iter_pair =
- common_range<_Range> && requires { typename iterator_traits<iterator_t<_Range>>::iterator_category; } &&
- derived_from<typename iterator_traits<iterator_t<_Range>>::iterator_category, input_iterator_tag> &&
- constructible_from<_Container, iterator_t<_Range>, sentinel_t<_Range>, _Args...>;
-
-template <class>
-concept __always_false = false;
-
-// `ranges::to` base template -- the `_Container` type is a simple type template parameter.
-template <class _Container, input_range _Range, class... _Args>
- requires(!view<_Container>)
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Container to(_Range&& __range, _Args&&... __args) {
- // Mandates: C is a cv-unqualified class type.
- static_assert(!is_const_v<_Container>, "The target container cannot be const-qualified, please remove the const");
- static_assert(
- !is_volatile_v<_Container>, "The target container cannot be volatile-qualified, please remove the volatile");
-
- // First see if the non-recursive case applies -- the conversion target is either:
- // - a range with a convertible value type;
- // - a non-range type which might support being created from the input argument(s) (e.g. an `optional`).
- if constexpr (__try_non_recursive_conversion<_Container, _Range>) {
- // Case 1 -- construct directly from the given range.
- if constexpr (constructible_from<_Container, _Range, _Args...>) {
- return _Container(std::forward<_Range>(__range), std::forward<_Args>(__args)...);
- }
-
- // Case 2 -- construct using the `from_range_t` tagged constructor.
- else if constexpr (constructible_from<_Container, from_range_t, _Range, _Args...>) {
- return _Container(from_range, std::forward<_Range>(__range), std::forward<_Args>(__args)...);
- }
-
- // Case 3 -- construct from a begin-end iterator pair.
- else if constexpr (__constructible_from_iter_pair<_Container, _Range, _Args...>) {
- return _Container(ranges::begin(__range), ranges::end(__range), std::forward<_Args>(__args)...);
- }
-
- // Case 4 -- default-construct (or construct from the extra arguments) and insert, reserving the size if possible.
- else if constexpr (constructible_from<_Container, _Args...> &&
- __container_insertable<_Container, range_reference_t<_Range>>) {
- _Container __result(std::forward<_Args>(__args)...);
- if constexpr (sized_range<_Range> && __reservable_container<_Container>) {
- __result.reserve(static_cast<range_size_t<_Container>>(ranges::size(__range)));
- }
-
- ranges::copy(__range, ranges::__container_inserter<range_reference_t<_Range>>(__result));
-
- return __result;
-
- } else {
- static_assert(__always_false<_Container>, "ranges::to: unable to convert to the given container type.");
- }
-
- // Try the recursive case.
- } else if constexpr (input_range<range_reference_t<_Range>>) {
- return ranges::to<_Container>(
- ref_view(__range) | views::transform([](auto&& __elem) {
- return ranges::to<range_value_t<_Container>>(std::forward<decltype(__elem)>(__elem));
- }),
- std::forward<_Args>(__args)...);
-
- } else {
- static_assert(__always_false<_Container>, "ranges::to: unable to convert to the given container type.");
- }
-}
-
-template <class _Range>
-struct __minimal_input_iterator {
- using iterator_category = input_iterator_tag;
- using value_type = range_value_t<_Range>;
- using difference_type = ptrdiff_t;
- using pointer = add_pointer_t<range_reference_t<_Range>>;
- using reference = range_reference_t<_Range>;
-
- reference operator*() const;
- pointer operator->() const;
- __minimal_input_iterator& operator++();
- __minimal_input_iterator operator++(int);
- bool operator==(const __minimal_input_iterator&) const;
-};
-
-// Deduces the full type of the container from the given template template parameter.
-template <template <class...> class _Container, input_range _Range, class... _Args>
-struct _Deducer {
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __deduce_func() {
- using _InputIter = __minimal_input_iterator<_Range>;
-
- // Case 1 -- can construct directly from the given range.
- if constexpr (requires { _Container(std::declval<_Range>(), std::declval<_Args>()...); }) {
- using _Result = decltype( //
- _Container(std::declval<_Range>(), std::declval<_Args>()...));
- return type_identity<_Result>{};
-
- // Case 2 -- can construct from the given range using the `from_range_t` tagged constructor.
- } else if constexpr ( //
- requires { _Container(from_range, std::declval<_Range>(), std::declval<_Args>()...); }) {
- using _Result = //
- decltype(_Container(from_range, std::declval<_Range>(), std::declval<_Args>()...));
- return type_identity<_Result>{};
-
- // Case 3 -- can construct from a begin-end iterator pair.
- } else if constexpr ( //
- requires { _Container(std::declval<_InputIter>(), std::declval<_InputIter>(), std::declval<_Args>()...); }) {
- using _Result =
- decltype(_Container(std::declval<_InputIter>(), std::declval<_InputIter>(), std::declval<_Args>()...));
- return type_identity<_Result>{};
-
- } else {
- static_assert(__always_false<_Range>,
- "ranges::to: unable to deduce the container type from the template template argument.");
- }
- }
-
- using type = typename decltype(__deduce_func())::type;
-};
-
-// `ranges::to` specialization -- `_Container` is a template template parameter requiring deduction to figure out the
-// container element type.
-template <template <class...> class _Container, input_range _Range, class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto to(_Range&& __range, _Args&&... __args) {
- using _DeduceExpr = typename _Deducer<_Container, _Range, _Args...>::type;
- return ranges::to<_DeduceExpr>(std::forward<_Range>(__range), std::forward<_Args>(__args)...);
-}
-
-// Range adaptor closure object 1 -- wrapping the `ranges::to` version where `_Container` is a simple type template
-// parameter.
-template <class _Container, class... _Args>
- requires(!view<_Container>)
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto to(_Args&&... __args) {
- // Mandates: C is a cv-unqualified class type.
- static_assert(!is_const_v<_Container>, "The target container cannot be const-qualified, please remove the const");
- static_assert(
- !is_volatile_v<_Container>, "The target container cannot be volatile-qualified, please remove the volatile");
-
- auto __to_func = []<input_range _Range, class... _Tail>(_Range&& __range, _Tail&&... __tail) static
- requires requires { //
- /**/ ranges::to<_Container>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...);
- }
- { return ranges::to<_Container>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...); };
-
- return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
-}
-
-// Range adaptor closure object 2 -- wrapping the `ranges::to` version where `_Container` is a template template
-// parameter.
-template <template <class...> class _Container, class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto to(_Args&&... __args) {
- // clang-format off
- auto __to_func = []<input_range _Range, class... _Tail,
- class _DeducedExpr = typename _Deducer<_Container, _Range, _Tail...>::type>
- (_Range&& __range, _Tail&& ... __tail) static
- requires requires { //
- /**/ ranges::to<_DeducedExpr>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...);
- }
- {
- return ranges::to<_DeducedExpr>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...);
- };
- // clang-format on
-
- return __range_adaptor_closure_t(std::__bind_back(__to_func, std::forward<_Args>(__args)...));
-}
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_TO_H
diff --git a/libcxx/include/__cxx03/__ranges/transform_view.h b/libcxx/include/__cxx03/__ranges/transform_view.h
deleted file mode 100644
index b4e7dde7ee91b..0000000000000
--- a/libcxx/include/__cxx03/__ranges/transform_view.h
+++ /dev/null
@@ -1,417 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_TRANSFORM_VIEW_H
-#define _LIBCPP___CXX03___RANGES_TRANSFORM_VIEW_H
-
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/copyable.h>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/bind_back.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/perfect_forward.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/movable_box.h>
-#include <__cxx03/__ranges/range_adaptor.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-template <class _Fn, class _View>
-concept __regular_invocable_with_range_ref = regular_invocable<_Fn, range_reference_t<_View>>;
-
-template <class _View, class _Fn>
-concept __transform_view_constraints =
- view<_View> && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_View>> &&
- __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>;
-
-# if _LIBCPP_STD_VER >= 23
-template <input_range _View, move_constructible _Fn>
-# else
-template <input_range _View, copy_constructible _Fn>
-# endif
- requires __transform_view_constraints<_View, _Fn>
-class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interface<transform_view<_View, _Fn>> {
- template <bool>
- class __iterator;
- template <bool>
- class __sentinel;
-
- _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __func_;
- _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
-
-public:
- _LIBCPP_HIDE_FROM_ABI transform_view()
- requires default_initializable<_View> && default_initializable<_Fn>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
- : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
- requires copy_constructible<_View>
- {
- return __base_;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { return __iterator<false>{*this, ranges::begin(__base_)}; }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
- requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __iterator<true>(*this, ranges::begin(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { return __sentinel<false>(ranges::end(__base_)); }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end()
- requires common_range<_View>
- {
- return __iterator<false>(*this, ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const
- requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __sentinel<true>(ranges::end(__base_));
- }
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const
- requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
- {
- return __iterator<true>(*this, ranges::end(__base_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires sized_range<_View>
- {
- return ranges::size(__base_);
- }
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires sized_range<const _View>
- {
- return ranges::size(__base_);
- }
-};
-
-template <class _Range, class _Fn>
-transform_view(_Range&&, _Fn) -> transform_view<views::all_t<_Range>, _Fn>;
-
-template <class _View>
-struct __transform_view_iterator_concept {
- using type = input_iterator_tag;
-};
-
-template <random_access_range _View>
-struct __transform_view_iterator_concept<_View> {
- using type = random_access_iterator_tag;
-};
-
-template <bidirectional_range _View>
-struct __transform_view_iterator_concept<_View> {
- using type = bidirectional_iterator_tag;
-};
-
-template <forward_range _View>
-struct __transform_view_iterator_concept<_View> {
- using type = forward_iterator_tag;
-};
-
-template <class, class>
-struct __transform_view_iterator_category_base {};
-
-template <forward_range _View, class _Fn>
-struct __transform_view_iterator_category_base<_View, _Fn> {
- using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category;
-
- using iterator_category =
- conditional_t< is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>,
- conditional_t< derived_from<_Cat, contiguous_iterator_tag>, random_access_iterator_tag, _Cat >,
- input_iterator_tag >;
-};
-
-# if _LIBCPP_STD_VER >= 23
-template <input_range _View, move_constructible _Fn>
-# else
-template <input_range _View, copy_constructible _Fn>
-# endif
- requires __transform_view_constraints<_View, _Fn>
-template <bool _Const>
-class transform_view<_View, _Fn>::__iterator : public __transform_view_iterator_category_base<_View, _Fn> {
-
- using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
-
- _Parent* __parent_ = nullptr;
-
- template <bool>
- friend class transform_view<_View, _Fn>::__iterator;
-
- template <bool>
- friend class transform_view<_View, _Fn>::__sentinel;
-
-public:
- iterator_t<_Base> __current_ = iterator_t<_Base>();
-
- using iterator_concept = typename __transform_view_iterator_concept<_View>::type;
- using value_type = remove_cvref_t<invoke_result_t<_Fn&, range_reference_t<_Base>>>;
- using difference_type = range_difference_t<_Base>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator()
- requires default_initializable<iterator_t<_Base>>
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current)
- : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {}
-
- // Note: `__i` should always be `__iterator<false>`, but directly using
- // `__iterator<false>` is ill-formed when `_Const` is false
- // (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
- requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
- : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
- noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) {
- return std::invoke(*__parent_->__func_, *__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- ++__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires forward_range<_Base>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires bidirectional_range<_Base>
- {
- --__current_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires bidirectional_range<_Base>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
- requires random_access_range<_Base>
- {
- __current_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
- noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
- requires random_access_range<_Base>
- {
- return std::invoke(*__parent_->__func_, __current_[__n]);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires equality_comparable<iterator_t<_Base>>
- {
- return __x.__current_ == __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ < __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ > __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ <= __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base>
- {
- return __x.__current_ >= __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
- {
- return __x.__current_ <=> __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ + __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ + __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
- requires random_access_range<_Base>
- {
- return __iterator{*__i.__parent_, __i.__current_ - __n};
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
- {
- return __x.__current_ - __y.__current_;
- }
-};
-
-# if _LIBCPP_STD_VER >= 23
-template <input_range _View, move_constructible _Fn>
-# else
-template <input_range _View, copy_constructible _Fn>
-# endif
- requires __transform_view_constraints<_View, _Fn>
-template <bool _Const>
-class transform_view<_View, _Fn>::__sentinel {
- using _Parent = __maybe_const<_Const, transform_view>;
- using _Base = __maybe_const<_Const, _View>;
-
- sentinel_t<_Base> __end_ = sentinel_t<_Base>();
-
- template <bool>
- friend class transform_view<_View, _Fn>::__iterator;
-
- template <bool>
- friend class transform_view<_View, _Fn>::__sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {}
-
- // Note: `__i` should always be `__sentinel<false>`, but directly using
- // `__sentinel<false>` is ill-formed when `_Const` is false
- // (see http://wg21.link/class.copy.ctor#5).
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
- requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
- : __end_(std::move(__i.__end_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
-
- template <bool _OtherConst>
- requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__current_ == __y.__end_;
- }
-
- template <bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return __x.__current_ - __y.__end_;
- }
-
- template <bool _OtherConst>
- requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
- _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
- operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
- return __x.__end_ - __y.__current_;
- }
-};
-
-namespace views {
-namespace __transform {
-struct __fn {
- template <class _Range, class _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Fn&& __f) const
- noexcept(noexcept(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))))
- -> decltype(transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f))) {
- return transform_view(std::forward<_Range>(__range), std::forward<_Fn>(__f));
- }
-
- template <class _Fn>
- requires constructible_from<decay_t<_Fn>, _Fn>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __f) const
- noexcept(is_nothrow_constructible_v<decay_t<_Fn>, _Fn>) {
- return __range_adaptor_closure_t(std::__bind_back(*this, std::forward<_Fn>(__f)));
- }
-};
-} // namespace __transform
-
-inline namespace __cpo {
-inline constexpr auto transform = __transform::__fn{};
-} // namespace __cpo
-} // namespace views
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_TRANSFORM_VIEW_H
diff --git a/libcxx/include/__cxx03/__ranges/view_interface.h b/libcxx/include/__cxx03/__ranges/view_interface.h
deleted file mode 100644
index 956049eab6d4e..0000000000000
--- a/libcxx/include/__cxx03/__ranges/view_interface.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_VIEW_INTERFACE_H
-#define _LIBCPP___CXX03___RANGES_VIEW_INTERFACE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/derived_from.h>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/prev.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__type_traits/is_class.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__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 >= 20
-
-namespace ranges {
-
-template <class _Derived>
- requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>>
-class view_interface {
- _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept {
- static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
- return static_cast<_Derived&>(*this);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Derived const& __derived() const noexcept {
- static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface> && view<_Derived>);
- return static_cast<_Derived const&>(*this);
- }
-
-public:
- template <class _D2 = _Derived>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty()
- requires sized_range<_D2> || forward_range<_D2>
- {
- if constexpr (sized_range<_D2>) {
- return ranges::size(__derived()) == 0;
- } else {
- return ranges::begin(__derived()) == ranges::end(__derived());
- }
- }
-
- template <class _D2 = _Derived>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const
- requires sized_range<const _D2> || forward_range<const _D2>
- {
- if constexpr (sized_range<const _D2>) {
- return ranges::size(__derived()) == 0;
- } else {
- return ranges::begin(__derived()) == ranges::end(__derived());
- }
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool()
- requires requires(_D2& __t) { ranges::empty(__t); }
- {
- return !ranges::empty(__derived());
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const
- requires requires(const _D2& __t) { ranges::empty(__t); }
- {
- return !ranges::empty(__derived());
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr auto data()
- requires contiguous_iterator<iterator_t<_D2>>
- {
- return std::to_address(ranges::begin(__derived()));
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr auto data() const
- requires range<const _D2> && contiguous_iterator<iterator_t<const _D2>>
- {
- return std::to_address(ranges::begin(__derived()));
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires forward_range<_D2> && sized_sentinel_for<sentinel_t<_D2>, iterator_t<_D2>>
- {
- return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires forward_range<const _D2> && sized_sentinel_for<sentinel_t<const _D2>, iterator_t<const _D2>>
- {
- return std::__to_unsigned_like(ranges::end(__derived()) - ranges::begin(__derived()));
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front()
- requires forward_range<_D2>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
- return *ranges::begin(__derived());
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) front() const
- requires forward_range<const _D2>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view.");
- return *ranges::begin(__derived());
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back()
- requires bidirectional_range<_D2> && common_range<_D2>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
- return *ranges::prev(ranges::end(__derived()));
- }
-
- template <class _D2 = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) back() const
- requires bidirectional_range<const _D2> && common_range<const _D2>
- {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- !empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view.");
- return *ranges::prev(ranges::end(__derived()));
- }
-
- template <random_access_range _RARange = _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) {
- return ranges::begin(__derived())[__index];
- }
-
- template <random_access_range _RARange = const _Derived>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](range_difference_t<_RARange> __index) const {
- return ranges::begin(__derived())[__index];
- }
-};
-
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_VIEW_INTERFACE_H
diff --git a/libcxx/include/__cxx03/__ranges/views.h b/libcxx/include/__cxx03/__ranges/views.h
deleted file mode 100644
index 91fa1a933c22a..0000000000000
--- a/libcxx/include/__cxx03/__ranges/views.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_VIEWS
-#define _LIBCPP___CXX03___RANGES_VIEWS
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-namespace ranges {
-
-namespace views {}
-
-} // namespace ranges
-
-namespace views = ranges::views;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___RANGES_VIEWS
diff --git a/libcxx/include/__cxx03/__ranges/zip_view.h b/libcxx/include/__cxx03/__ranges/zip_view.h
deleted file mode 100644
index 3ba450db92192..0000000000000
--- a/libcxx/include/__cxx03/__ranges/zip_view.h
+++ /dev/null
@@ -1,516 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___RANGES_ZIP_VIEW_H
-#define _LIBCPP___CXX03___RANGES_ZIP_VIEW_H
-
-#include <__cxx03/__config>
-
-#include <__cxx03/__algorithm/ranges_min.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/incrementable_traits.h>
-#include <__cxx03/__iterator/iter_move.h>
-#include <__cxx03/__iterator/iter_swap.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/all.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/empty_view.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__ranges/view_interface.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-namespace ranges {
-
-template <class... _Ranges>
-concept __zip_is_common =
- (sizeof...(_Ranges) == 1 && (common_range<_Ranges> && ...)) ||
- (!(bidirectional_range<_Ranges> && ...) && (common_range<_Ranges> && ...)) ||
- ((random_access_range<_Ranges> && ...) && (sized_range<_Ranges> && ...));
-
-template <typename _Tp, typename _Up>
-auto __tuple_or_pair_test() -> pair<_Tp, _Up>;
-
-template <typename... _Types>
- requires(sizeof...(_Types) != 2)
-auto __tuple_or_pair_test() -> tuple<_Types...>;
-
-template <class... _Types>
-using __tuple_or_pair = decltype(__tuple_or_pair_test<_Types...>());
-
-template <class _Fun, class _Tuple>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_transform(_Fun&& __f, _Tuple&& __tuple) {
- return std::apply(
- [&]<class... _Types>(_Types&&... __elements) {
- return __tuple_or_pair<invoke_result_t<_Fun&, _Types>...>(
- std::invoke(__f, std::forward<_Types>(__elements))...);
- },
- std::forward<_Tuple>(__tuple));
-}
-
-template <class _Fun, class _Tuple>
-_LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tuple) {
- std::apply(
- [&]<class... _Types>(_Types&&... __elements) {
- (static_cast<void>(std::invoke(__f, std::forward<_Types>(__elements))), ...);
- },
- std::forward<_Tuple>(__tuple));
-}
-
-template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
-_LIBCPP_HIDE_FROM_ABI constexpr __tuple_or_pair<
- invoke_result_t<_Fun&,
- typename tuple_element<_Indices, remove_cvref_t<_Tuple1>>::type,
- typename tuple_element<_Indices, remove_cvref_t<_Tuple2>>::type>...>
-__tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
- return {std::invoke(__f,
- std::get<_Indices>(std::forward<_Tuple1>(__tuple1)),
- std::get<_Indices>(std::forward<_Tuple2>(__tuple2)))...};
-}
-
-template <class _Fun, class _Tuple1, class _Tuple2>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_transform(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_transform(
- __f,
- std::forward<_Tuple1>(__tuple1),
- std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
-}
-
-template <class _Fun, class _Tuple1, class _Tuple2, size_t... _Indices>
-_LIBCPP_HIDE_FROM_ABI constexpr void
-__tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2, index_sequence<_Indices...>) {
- (std::invoke(
- __f, std::get<_Indices>(std::forward<_Tuple1>(__tuple1)), std::get<_Indices>(std::forward<_Tuple2>(__tuple2))),
- ...);
-}
-
-template <class _Fun, class _Tuple1, class _Tuple2>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __tuple_zip_for_each(_Fun&& __f, _Tuple1&& __tuple1, _Tuple2&& __tuple2) {
- return ranges::__tuple_zip_for_each(
- __f,
- std::forward<_Tuple1>(__tuple1),
- std::forward<_Tuple2>(__tuple2),
- std::make_index_sequence<tuple_size<remove_cvref_t<_Tuple1>>::value>());
-}
-
-template <class _Tuple1, class _Tuple2>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __tuple_any_equals(const _Tuple1& __tuple1, const _Tuple2& __tuple2) {
- const auto __equals = ranges::__tuple_zip_transform(std::equal_to<>(), __tuple1, __tuple2);
- return std::apply([](auto... __bools) { return (__bools || ...); }, __equals);
-}
-
-// abs in cstdlib is not constexpr
-// TODO : remove __abs once P0533R9 is implemented.
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Tp __abs(_Tp __t) {
- return __t < 0 ? -__t : __t;
-}
-
-template <input_range... _Views>
- requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
-class zip_view : public view_interface<zip_view<_Views...>> {
- _LIBCPP_NO_UNIQUE_ADDRESS tuple<_Views...> __views_;
-
- template <bool>
- class __iterator;
-
- template <bool>
- class __sentinel;
-
-public:
- _LIBCPP_HIDE_FROM_ABI zip_view() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
- requires(!(__simple_view<_Views> && ...))
- {
- return __iterator<false>(ranges::__tuple_transform(ranges::begin, __views_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
- requires(range<const _Views> && ...)
- {
- return __iterator<true>(ranges::__tuple_transform(ranges::begin, __views_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end()
- requires(!(__simple_view<_Views> && ...))
- {
- if constexpr (!__zip_is_common<_Views...>) {
- return __sentinel<false>(ranges::__tuple_transform(ranges::end, __views_));
- } else if constexpr ((random_access_range<_Views> && ...)) {
- return begin() + iter_difference_t<__iterator<false>>(size());
- } else {
- return __iterator<false>(ranges::__tuple_transform(ranges::end, __views_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
- requires(range<const _Views> && ...)
- {
- if constexpr (!__zip_is_common<const _Views...>) {
- return __sentinel<true>(ranges::__tuple_transform(ranges::end, __views_));
- } else if constexpr ((random_access_range<const _Views> && ...)) {
- return begin() + iter_difference_t<__iterator<true>>(size());
- } else {
- return __iterator<true>(ranges::__tuple_transform(ranges::end, __views_));
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size()
- requires(sized_range<_Views> && ...)
- {
- return std::apply(
- [](auto... __sizes) {
- using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
- return ranges::min({_CT(__sizes)...});
- },
- ranges::__tuple_transform(ranges::size, __views_));
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
- requires(sized_range<const _Views> && ...)
- {
- return std::apply(
- [](auto... __sizes) {
- using _CT = make_unsigned_t<common_type_t<decltype(__sizes)...>>;
- return ranges::min({_CT(__sizes)...});
- },
- ranges::__tuple_transform(ranges::size, __views_));
- }
-};
-
-template <class... _Ranges>
-zip_view(_Ranges&&...) -> zip_view<views::all_t<_Ranges>...>;
-
-template <bool _Const, class... _Views>
-concept __zip_all_random_access = (random_access_range<__maybe_const<_Const, _Views>> && ...);
-
-template <bool _Const, class... _Views>
-concept __zip_all_bidirectional = (bidirectional_range<__maybe_const<_Const, _Views>> && ...);
-
-template <bool _Const, class... _Views>
-concept __zip_all_forward = (forward_range<__maybe_const<_Const, _Views>> && ...);
-
-template <bool _Const, class... _Views>
-consteval auto __get_zip_view_iterator_tag() {
- if constexpr (__zip_all_random_access<_Const, _Views...>) {
- return random_access_iterator_tag();
- } else if constexpr (__zip_all_bidirectional<_Const, _Views...>) {
- return bidirectional_iterator_tag();
- } else if constexpr (__zip_all_forward<_Const, _Views...>) {
- return forward_iterator_tag();
- } else {
- return input_iterator_tag();
- }
-}
-
-template <bool _Const, class... _Views>
-struct __zip_view_iterator_category_base {};
-
-template <bool _Const, class... _Views>
- requires __zip_all_forward<_Const, _Views...>
-struct __zip_view_iterator_category_base<_Const, _Views...> {
- using iterator_category = input_iterator_tag;
-};
-
-template <input_range... _Views>
- requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
-template <bool _Const>
-class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base<_Const, _Views...> {
- __tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current_;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(
- __tuple_or_pair<iterator_t<__maybe_const<_Const, _Views>>...> __current)
- : __current_(std::move(__current)) {}
-
- template <bool>
- friend class zip_view<_Views...>::__iterator;
-
- template <bool>
- friend class zip_view<_Views...>::__sentinel;
-
- friend class zip_view<_Views...>;
-
-public:
- using iterator_concept = decltype(__get_zip_view_iterator_tag<_Const, _Views...>());
- using value_type = __tuple_or_pair<range_value_t<__maybe_const<_Const, _Views>>...>;
- using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
-
- _LIBCPP_HIDE_FROM_ABI __iterator() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
- requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...)
- : __current_(std::move(__i.__current_)) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
- return ranges::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
- ranges::__tuple_for_each([](auto& __i) { ++__i; }, __current_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
- requires __zip_all_forward<_Const, _Views...>
- {
- auto __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
- requires __zip_all_bidirectional<_Const, _Views...>
- {
- ranges::__tuple_for_each([](auto& __i) { --__i; }, __current_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
- requires __zip_all_bidirectional<_Const, _Views...>
- {
- auto __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...>
- {
- ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i += iter_difference_t<_Iter>(__x); }, __current_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
- requires __zip_all_random_access<_Const, _Views...>
- {
- ranges::__tuple_for_each([&]<class _Iter>(_Iter& __i) { __i -= iter_difference_t<_Iter>(__x); }, __current_);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
- requires __zip_all_random_access<_Const, _Views...>
- {
- return ranges::__tuple_transform(
- [&]<class _Iter>(_Iter& __i) -> decltype(auto) { return __i[iter_difference_t<_Iter>(__n)]; }, __current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
- requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
- {
- if constexpr (__zip_all_bidirectional<_Const, _Views...>) {
- return __x.__current_ == __y.__current_;
- } else {
- return ranges::__tuple_any_equals(__x.__current_, __y.__current_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...>
- {
- return __x.__current_ < __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...>
- {
- return __y < __x;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...>
- {
- return !(__y < __x);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...>
- {
- return !(__x < __y);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
- requires __zip_all_random_access<_Const, _Views...> &&
- (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
- {
- return __x.__current_ <=> __y.__current_;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...>
- {
- auto __r = __i;
- __r += __n;
- return __r;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
- requires __zip_all_random_access<_Const, _Views...>
- {
- return __i + __n;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
- requires __zip_all_random_access<_Const, _Views...>
- {
- auto __r = __i;
- __r -= __n;
- return __r;
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
- requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
- ...)
- {
- const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __x.__current_, __y.__current_);
- return std::apply(
- [](auto... __ds) {
- return ranges::min({difference_type(__ds)...}, [](auto __a, auto __b) {
- return ranges::__abs(__a) < ranges::__abs(__b);
- });
- },
- __diffs);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
- (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) &&
- (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) {
- return ranges::__tuple_transform(ranges::iter_move, __i.__current_);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __l, const __iterator& __r) noexcept(
- (noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>(),
- std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) &&
- ...))
- requires(indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
- {
- ranges::__tuple_zip_for_each(ranges::iter_swap, __l.__current_, __r.__current_);
- }
-};
-
-template <input_range... _Views>
- requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
-template <bool _Const>
-class zip_view<_Views...>::__sentinel {
- __tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end_;
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(
- __tuple_or_pair<sentinel_t<__maybe_const<_Const, _Views>>...> __end)
- : __end_(__end) {}
-
- friend class zip_view<_Views...>;
-
- // hidden friend cannot access private member of iterator because they are friends of friends
- template <bool _OtherConst>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
- __iter_current(zip_view<_Views...>::__iterator<_OtherConst> const& __it) {
- return (__it.__current_);
- }
-
-public:
- _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
- requires _Const && (convertible_to<sentinel_t<_Views>, sentinel_t<__maybe_const<_Const, _Views>>> && ...)
- : __end_(std::move(__i.__end_)) {}
-
- template <bool _OtherConst>
- requires(sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
- ...)
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- return ranges::__tuple_any_equals(__iter_current(__x), __y.__end_);
- }
-
- template <bool _OtherConst>
- requires(
- sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
- ...)
- _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>
- operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
- const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __iter_current(__x), __y.__end_);
- return std::apply(
- [](auto... __ds) {
- using _Diff = common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>;
- return ranges::min({_Diff(__ds)...}, [](auto __a, auto __b) {
- return ranges::__abs(__a) < ranges::__abs(__b);
- });
- },
- __diffs);
- }
-
- template <bool _OtherConst>
- requires(
- sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
- ...)
- _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>
- operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) {
- return -(__x - __y);
- }
-};
-
-template <class... _Views>
-inline constexpr bool enable_borrowed_range<zip_view<_Views...>> = (enable_borrowed_range<_Views> && ...);
-
-namespace views {
-namespace __zip {
-
-struct __fn {
- _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()() noexcept { return empty_view<tuple<>>{}; }
-
- template <class... _Ranges>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- operator()(_Ranges&&... __rs) noexcept(noexcept(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)))
- -> decltype(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)) {
- return zip_view<all_t<_Ranges>...>(std::forward<_Ranges>(__rs)...);
- }
-};
-
-} // namespace __zip
-inline namespace __cpo {
-inline constexpr auto zip = __zip::__fn{};
-} // namespace __cpo
-} // namespace views
-} // namespace ranges
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___RANGES_ZIP_VIEW_H
diff --git a/libcxx/include/__cxx03/__stop_token/atomic_unique_lock.h b/libcxx/include/__cxx03/__stop_token/atomic_unique_lock.h
deleted file mode 100644
index 92b17350b3bbb..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/atomic_unique_lock.h
+++ /dev/null
@@ -1,140 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H
-#define _LIBCPP___CXX03___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H
-
-#include <__cxx03/__bit/popcount.h>
-#include <__cxx03/__config>
-#include <__cxx03/atomic>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// This class implements an RAII unique_lock without a mutex.
-// It uses std::atomic<State>,
-// where State contains a lock bit and might contain other data,
-// and LockedBit is the value of State when the lock bit is set, e.g 1 << 2
-template <class _State, _State _LockedBit>
-class _LIBCPP_AVAILABILITY_SYNC __atomic_unique_lock {
- static_assert(std::__libcpp_popcount(static_cast<unsigned long long>(_LockedBit)) == 1,
- "LockedBit must be an integer where only one bit is set");
-
- std::atomic<_State>& __state_;
- bool __is_locked_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI explicit __atomic_unique_lock(std::atomic<_State>& __state) noexcept
- : __state_(__state), __is_locked_(true) {
- __lock();
- }
-
- template <class _Pred>
- _LIBCPP_HIDE_FROM_ABI __atomic_unique_lock(std::atomic<_State>& __state, _Pred&& __give_up_locking) noexcept
- : __state_(__state), __is_locked_(false) {
- __is_locked_ = __lock_impl(__give_up_locking, __set_locked_bit, std::memory_order_acquire);
- }
-
- template <class _Pred, class _UnaryFunction>
- _LIBCPP_HIDE_FROM_ABI __atomic_unique_lock(
- std::atomic<_State>& __state,
- _Pred&& __give_up_locking,
- _UnaryFunction&& __state_after_lock,
- std::memory_order __locked_ordering) noexcept
- : __state_(__state), __is_locked_(false) {
- __is_locked_ = __lock_impl(__give_up_locking, __state_after_lock, __locked_ordering);
- }
-
- __atomic_unique_lock(const __atomic_unique_lock&) = delete;
- __atomic_unique_lock(__atomic_unique_lock&&) = delete;
- __atomic_unique_lock& operator=(const __atomic_unique_lock&) = delete;
- __atomic_unique_lock& operator=(__atomic_unique_lock&&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI ~__atomic_unique_lock() {
- if (__is_locked_) {
- __unlock();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI bool __owns_lock() const noexcept { return __is_locked_; }
-
- _LIBCPP_HIDE_FROM_ABI void __lock() noexcept {
- const auto __never_give_up_locking = [](_State) { return false; };
- // std::memory_order_acquire because we'd like to make sure that all the read operations after the lock can read the
- // up-to-date values.
- __lock_impl(__never_give_up_locking, __set_locked_bit, std::memory_order_acquire);
- __is_locked_ = true;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __unlock() noexcept {
- // unset the _LockedBit. `memory_order_release` because we need to make sure all the write operations before calling
- // `__unlock` will be made visible to other threads
- __state_.fetch_and(static_cast<_State>(~_LockedBit), std::memory_order_release);
- __state_.notify_all();
- __is_locked_ = false;
- }
-
-private:
- template <class _Pred, class _UnaryFunction>
- _LIBCPP_HIDE_FROM_ABI bool
- __lock_impl(_Pred&& __give_up_locking, // while trying to lock the state, if the predicate returns true, give up
- // locking and return
- _UnaryFunction&& __state_after_lock,
- std::memory_order __locked_ordering) noexcept {
- // At this stage, until we exit the inner while loop, other than the atomic state, we are not reading any order
- // dependent values that is written on other threads, or writing anything that needs to be seen on other threads.
- // Therefore `memory_order_relaxed` is enough.
- _State __current_state = __state_.load(std::memory_order_relaxed);
- do {
- while (true) {
- if (__give_up_locking(__current_state)) {
- // user provided early return condition. fail to lock
- return false;
- } else if ((__current_state & _LockedBit) != 0) {
- // another thread has locked the state, we need to wait
- __state_.wait(__current_state, std::memory_order_relaxed);
- // when it is woken up by notifyAll or spuriously, the __state_
- // might have changed. reload the state
- // Note that the new state's _LockedBit may or may not equal to 0
- __current_state = __state_.load(std::memory_order_relaxed);
- } else {
- // at least for now, it is not locked. we can try `compare_exchange_weak` to lock it.
- // Note that the variable `__current_state`'s lock bit has to be 0 at this point.
- break;
- }
- }
- } while (!__state_.compare_exchange_weak(
- __current_state, // if __state_ has the same value of __current_state, lock bit must be zero before exchange and
- // we are good to lock/exchange and return. If _state has a different value, because other
- // threads locked it between the `break` statement above and this statement, exchange will fail
- // and go back to the inner while loop above.
- __state_after_lock(__current_state), // state after lock. Usually it should be __current_state | _LockedBit.
- // Some use cases need to set other bits at the same time as an atomic
- // operation therefore we accept a function
- __locked_ordering, // sucessful exchange order. Usually it should be std::memory_order_acquire.
- // Some use cases need more strict ordering therefore we accept it as a parameter
- std::memory_order_relaxed // fail to exchange order. We don't need any ordering as we are going back to the
- // inner while loop
- ));
- return true;
- }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; };
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_ATOMIC_UNIQUE_GUARD_H
diff --git a/libcxx/include/__cxx03/__stop_token/intrusive_list_view.h b/libcxx/include/__cxx03/__stop_token/intrusive_list_view.h
deleted file mode 100644
index 8c133ad30c609..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/intrusive_list_view.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H
-#define _LIBCPP___CXX03___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Derived>
-struct __intrusive_node_base {
- _Derived* __next_ = nullptr;
- _Derived* __prev_ = nullptr;
-};
-
-// This class is a view of underlying double-linked list.
-// It does not own the nodes. It provides user-friendly
-// operations on the linked list.
-template <class _Node>
-struct __intrusive_list_view {
- _LIBCPP_HIDE_FROM_ABI __intrusive_list_view() = default;
- _LIBCPP_HIDE_FROM_ABI __intrusive_list_view(__intrusive_list_view const&) = default;
- _LIBCPP_HIDE_FROM_ABI __intrusive_list_view(__intrusive_list_view&&) = default;
- _LIBCPP_HIDE_FROM_ABI __intrusive_list_view& operator=(__intrusive_list_view const&) = default;
- _LIBCPP_HIDE_FROM_ABI __intrusive_list_view& operator=(__intrusive_list_view&&) = default;
- _LIBCPP_HIDE_FROM_ABI ~__intrusive_list_view() = default;
-
- _LIBCPP_HIDE_FROM_ABI bool __empty() const noexcept { return __head_ == nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI void __push_front(_Node* __node) noexcept {
- __node->__next_ = __head_;
- if (__head_) {
- __head_->__prev_ = __node;
- }
- __head_ = __node;
- }
-
- _LIBCPP_HIDE_FROM_ABI _Node* __pop_front() noexcept {
- _Node* __front = __head_;
- __head_ = __head_->__next_;
- if (__head_) {
- __head_->__prev_ = nullptr;
- }
- // OK not to set __front->__next_ = nullptr as __front is not part of the list anymore
- return __front;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __remove(_Node* __node) noexcept {
- if (__node->__prev_) {
- // prev exists, set its next to our next to skip __node
- __node->__prev_->__next_ = __node->__next_;
- if (__node->__next_) {
- __node->__next_->__prev_ = __node->__prev_;
- }
- } else {
- _LIBCPP_ASSERT_INTERNAL(__node == __head_, "Node to be removed has no prev node, so it has to be the head");
- __pop_front();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI bool __is_head(_Node* __node) noexcept { return __node == __head_; }
-
-private:
- _Node* __head_ = nullptr;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H
diff --git a/libcxx/include/__cxx03/__stop_token/intrusive_shared_ptr.h b/libcxx/include/__cxx03/__stop_token/intrusive_shared_ptr.h
deleted file mode 100644
index 002cdad80f0ae..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/intrusive_shared_ptr.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
-#define _LIBCPP___CXX03___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
-
-#include <__cxx03/__atomic/atomic.h>
-#include <__cxx03/__atomic/memory_order.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-// For intrusive_shared_ptr to work with a type T, specialize __intrusive_shared_ptr_traits<T> and implement
-// the following function:
-//
-// static std::atomic<U>& __get_atomic_ref_count(T&);
-//
-// where U must be an integral type representing the number of references to the object.
-template <class _Tp>
-struct __intrusive_shared_ptr_traits;
-
-// A reference counting shared_ptr for types whose reference counter
-// is stored inside the class _Tp itself.
-// When the reference count goes to zero, the destructor of _Tp will be called
-template <class _Tp>
-struct __intrusive_shared_ptr {
- _LIBCPP_HIDE_FROM_ABI __intrusive_shared_ptr() = default;
-
- _LIBCPP_HIDE_FROM_ABI explicit __intrusive_shared_ptr(_Tp* __raw_ptr) : __raw_ptr_(__raw_ptr) {
- if (__raw_ptr_)
- __increment_ref_count(*__raw_ptr_);
- }
-
- _LIBCPP_HIDE_FROM_ABI __intrusive_shared_ptr(const __intrusive_shared_ptr& __other) noexcept
- : __raw_ptr_(__other.__raw_ptr_) {
- if (__raw_ptr_)
- __increment_ref_count(*__raw_ptr_);
- }
-
- _LIBCPP_HIDE_FROM_ABI __intrusive_shared_ptr(__intrusive_shared_ptr&& __other) noexcept
- : __raw_ptr_(__other.__raw_ptr_) {
- __other.__raw_ptr_ = nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI __intrusive_shared_ptr& operator=(const __intrusive_shared_ptr& __other) noexcept {
- if (__other.__raw_ptr_ != __raw_ptr_) {
- if (__other.__raw_ptr_) {
- __increment_ref_count(*__other.__raw_ptr_);
- }
- if (__raw_ptr_) {
- __decrement_ref_count(*__raw_ptr_);
- }
- __raw_ptr_ = __other.__raw_ptr_;
- }
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI __intrusive_shared_ptr& operator=(__intrusive_shared_ptr&& __other) noexcept {
- __intrusive_shared_ptr(std::move(__other)).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ~__intrusive_shared_ptr() {
- if (__raw_ptr_) {
- __decrement_ref_count(*__raw_ptr_);
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const noexcept { return __raw_ptr_; }
- _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const noexcept { return *__raw_ptr_; }
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __raw_ptr_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI void swap(__intrusive_shared_ptr& __other) { std::swap(__raw_ptr_, __other.__raw_ptr_); }
-
- _LIBCPP_HIDE_FROM_ABI friend void swap(__intrusive_shared_ptr& __lhs, __intrusive_shared_ptr& __rhs) {
- __lhs.swap(__rhs);
- }
-
- _LIBCPP_HIDE_FROM_ABI friend bool constexpr
- operator==(const __intrusive_shared_ptr&, const __intrusive_shared_ptr&) = default;
-
- _LIBCPP_HIDE_FROM_ABI friend bool constexpr operator==(const __intrusive_shared_ptr& __ptr, std::nullptr_t) {
- return __ptr.__raw_ptr_ == nullptr;
- }
-
-private:
- _Tp* __raw_ptr_ = nullptr;
-
- // the memory order for increment/decrement the counter is the same for shared_ptr
- // increment is relaxed and decrement is acq_rel
- _LIBCPP_HIDE_FROM_ABI static void __increment_ref_count(_Tp& __obj) {
- __get_atomic_ref_count(__obj).fetch_add(1, std::memory_order_relaxed);
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __decrement_ref_count(_Tp& __obj) {
- if (__get_atomic_ref_count(__obj).fetch_sub(1, std::memory_order_acq_rel) == 1) {
- delete &__obj;
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI static decltype(auto) __get_atomic_ref_count(_Tp& __obj) {
- using __ret_type = decltype(__intrusive_shared_ptr_traits<_Tp>::__get_atomic_ref_count(__obj));
- static_assert(
- std::is_reference_v<__ret_type>, "__get_atomic_ref_count should return a reference to the atomic counter");
- return __intrusive_shared_ptr_traits<_Tp>::__get_atomic_ref_count(__obj);
- }
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
diff --git a/libcxx/include/__cxx03/__stop_token/stop_callback.h b/libcxx/include/__cxx03/__stop_token/stop_callback.h
deleted file mode 100644
index 5a92b59e30b01..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/stop_callback.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_STOP_CALLBACK_H
-#define _LIBCPP___CXX03___STOP_TOKEN_STOP_CALLBACK_H
-
-#include <__cxx03/__concepts/constructible.h>
-#include <__cxx03/__concepts/destructible.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__stop_token/intrusive_shared_ptr.h>
-#include <__cxx03/__stop_token/stop_state.h>
-#include <__cxx03/__stop_token/stop_token.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/private_constructor_tag.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-template <class _Callback>
-class _LIBCPP_AVAILABILITY_SYNC stop_callback : private __stop_callback_base {
- static_assert(invocable<_Callback>,
- "Mandates: stop_callback is instantiated with an argument for the template parameter Callback that "
- "satisfies invocable.");
- static_assert(destructible<_Callback>,
- "Mandates: stop_callback is instantiated with an argument for the template parameter Callback that "
- "satisfies destructible.");
-
-public:
- using callback_type = _Callback;
-
- template <class _Cb>
- requires constructible_from<_Callback, _Cb>
- _LIBCPP_HIDE_FROM_ABI explicit stop_callback(const stop_token& __st,
- _Cb&& __cb) noexcept(is_nothrow_constructible_v<_Callback, _Cb>)
- : stop_callback(__private_constructor_tag{}, __st.__state_, std::forward<_Cb>(__cb)) {}
-
- template <class _Cb>
- requires constructible_from<_Callback, _Cb>
- _LIBCPP_HIDE_FROM_ABI explicit stop_callback(stop_token&& __st,
- _Cb&& __cb) noexcept(is_nothrow_constructible_v<_Callback, _Cb>)
- : stop_callback(__private_constructor_tag{}, std::move(__st.__state_), std::forward<_Cb>(__cb)) {}
-
- _LIBCPP_HIDE_FROM_ABI ~stop_callback() {
- if (__state_) {
- __state_->__remove_callback(this);
- }
- }
-
- stop_callback(const stop_callback&) = delete;
- stop_callback(stop_callback&&) = delete;
- stop_callback& operator=(const stop_callback&) = delete;
- stop_callback& operator=(stop_callback&&) = delete;
-
-private:
- _LIBCPP_NO_UNIQUE_ADDRESS _Callback __callback_;
- __intrusive_shared_ptr<__stop_state> __state_;
-
- friend __stop_callback_base;
-
- template <class _StatePtr, class _Cb>
- _LIBCPP_HIDE_FROM_ABI explicit stop_callback(__private_constructor_tag, _StatePtr&& __state, _Cb&& __cb) noexcept(
- is_nothrow_constructible_v<_Callback, _Cb>)
- : __stop_callback_base([](__stop_callback_base* __cb_base) noexcept {
- // stop callback is supposed to only be called once
- std::forward<_Callback>(static_cast<stop_callback*>(__cb_base)->__callback_)();
- }),
- __callback_(std::forward<_Cb>(__cb)),
- __state_() {
- if (__state && __state->__add_callback(this)) {
- // st.stop_requested() was false and this is successfully added to the linked list
- __state_ = std::forward<_StatePtr>(__state);
- }
- }
-};
-
-template <class _Callback>
-_LIBCPP_AVAILABILITY_SYNC stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_STOP_CALLBACK_H
diff --git a/libcxx/include/__cxx03/__stop_token/stop_source.h b/libcxx/include/__cxx03/__stop_token/stop_source.h
deleted file mode 100644
index 83fcfa548a859..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/stop_source.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_STOP_SOURCE_H
-#define _LIBCPP___CXX03___STOP_TOKEN_STOP_SOURCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__stop_token/intrusive_shared_ptr.h>
-#include <__cxx03/__stop_token/stop_state.h>
-#include <__cxx03/__stop_token/stop_token.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-struct nostopstate_t {
- explicit nostopstate_t() = default;
-};
-
-inline constexpr nostopstate_t nostopstate{};
-
-class _LIBCPP_AVAILABILITY_SYNC stop_source {
-public:
- _LIBCPP_HIDE_FROM_ABI stop_source() : __state_(new __stop_state()) { __state_->__increment_stop_source_counter(); }
-
- _LIBCPP_HIDE_FROM_ABI explicit stop_source(nostopstate_t) noexcept : __state_(nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI stop_source(const stop_source& __other) noexcept : __state_(__other.__state_) {
- if (__state_) {
- __state_->__increment_stop_source_counter();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI stop_source(stop_source&& __other) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI stop_source& operator=(const stop_source& __other) noexcept {
- // increment `__other` first so that we don't hit 0 in case of self-assignment
- if (__other.__state_) {
- __other.__state_->__increment_stop_source_counter();
- }
- if (__state_) {
- __state_->__decrement_stop_source_counter();
- }
- __state_ = __other.__state_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI stop_source& operator=(stop_source&&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI ~stop_source() {
- if (__state_) {
- __state_->__decrement_stop_source_counter();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(stop_source& __other) noexcept { __state_.swap(__other.__state_); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI stop_token get_token() const noexcept { return stop_token(__state_); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool stop_possible() const noexcept { return __state_ != nullptr; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool stop_requested() const noexcept {
- return __state_ != nullptr && __state_->__stop_requested();
- }
-
- _LIBCPP_HIDE_FROM_ABI bool request_stop() noexcept { return __state_ && __state_->__request_stop(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend bool operator==(const stop_source&, const stop_source&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI friend void swap(stop_source& __lhs, stop_source& __rhs) noexcept { __lhs.swap(__rhs); }
-
-private:
- __intrusive_shared_ptr<__stop_state> __state_;
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_STOP_SOURCE_H
diff --git a/libcxx/include/__cxx03/__stop_token/stop_state.h b/libcxx/include/__cxx03/__stop_token/stop_state.h
deleted file mode 100644
index 2faee49440f8a..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/stop_state.h
+++ /dev/null
@@ -1,236 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_STOP_STATE_H
-#define _LIBCPP___CXX03___STOP_TOKEN_STOP_STATE_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__config>
-#include <__cxx03/__stop_token/atomic_unique_lock.h>
-#include <__cxx03/__stop_token/intrusive_list_view.h>
-#include <__cxx03/__thread/id.h>
-#include <__cxx03/atomic>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
-
-struct __stop_callback_base : __intrusive_node_base<__stop_callback_base> {
- using __callback_fn_t = void(__stop_callback_base*) noexcept;
- _LIBCPP_HIDE_FROM_ABI explicit __stop_callback_base(__callback_fn_t* __callback_fn) : __callback_fn_(__callback_fn) {}
-
- _LIBCPP_HIDE_FROM_ABI void __invoke() noexcept { __callback_fn_(this); }
-
- __callback_fn_t* __callback_fn_;
- atomic<bool> __completed_ = false;
- bool* __destroyed_ = nullptr;
-};
-
-class __stop_state {
- static constexpr uint32_t __stop_requested_bit = 1;
- static constexpr uint32_t __callback_list_locked_bit = 1 << 1;
- static constexpr uint32_t __stop_source_counter_shift = 2;
-
- // The "stop_source counter" is not used for lifetime reference counting.
- // When the number of stop_source reaches 0, the remaining stop_tokens's
- // stop_possible will return false. We need this counter to track this.
- //
- // The "callback list locked" bit implements the atomic_unique_lock to
- // guard the operations on the callback list
- //
- // 31 - 2 | 1 | 0 |
- // stop_source counter | callback list locked | stop_requested |
- atomic<uint32_t> __state_ = 0;
-
- // Reference count for stop_token + stop_callback + stop_source
- // When the counter reaches zero, the state is destroyed
- // It is used by __intrusive_shared_ptr, but it is stored here for better layout
- atomic<uint32_t> __ref_count_ = 0;
-
- using __state_t = uint32_t;
- using __callback_list_lock = __atomic_unique_lock<__state_t, __callback_list_locked_bit>;
- using __callback_list = __intrusive_list_view<__stop_callback_base>;
-
- __callback_list __callback_list_;
- __thread_id __requesting_thread_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI __stop_state() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI void __increment_stop_source_counter() noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __state_.load(std::memory_order_relaxed) <= static_cast<__state_t>(~(1 << __stop_source_counter_shift)),
- "stop_source's counter reaches the maximum. Incrementing the counter will overflow");
- __state_.fetch_add(1 << __stop_source_counter_shift, std::memory_order_relaxed);
- }
-
- // We are not destroying the object after counter decrements to zero, nor do we have
- // operations depend on the ordering of decrementing the counter. relaxed is enough.
- _LIBCPP_HIDE_FROM_ABI void __decrement_stop_source_counter() noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- __state_.load(std::memory_order_relaxed) >= static_cast<__state_t>(1 << __stop_source_counter_shift),
- "stop_source's counter is 0. Decrementing the counter will underflow");
- __state_.fetch_sub(1 << __stop_source_counter_shift, std::memory_order_relaxed);
- }
-
- _LIBCPP_HIDE_FROM_ABI bool __stop_requested() const noexcept {
- // acquire because [thread.stoptoken.intro] A call to request_stop that returns true
- // synchronizes with a call to stop_requested on an associated stop_token or stop_source
- // object that returns true.
- // request_stop's compare_exchange_weak has release which syncs with this acquire
- return (__state_.load(std::memory_order_acquire) & __stop_requested_bit) != 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI bool __stop_possible_for_stop_token() const noexcept {
- // [stoptoken.mem] false if "a stop request was not made and there are no associated stop_source objects"
- // Todo: Can this be std::memory_order_relaxed as the standard does not say anything except not to introduce data
- // race?
- __state_t __curent_state = __state_.load(std::memory_order_acquire);
- return ((__curent_state & __stop_requested_bit) != 0) || ((__curent_state >> __stop_source_counter_shift) != 0);
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __request_stop() noexcept {
- auto __cb_list_lock = __try_lock_for_request_stop();
- if (!__cb_list_lock.__owns_lock()) {
- return false;
- }
- __requesting_thread_ = this_thread::get_id();
-
- while (!__callback_list_.__empty()) {
- auto __cb = __callback_list_.__pop_front();
-
- // allow other callbacks to be removed while invoking the current callback
- __cb_list_lock.__unlock();
-
- bool __destroyed = false;
- __cb->__destroyed_ = &__destroyed;
-
- __cb->__invoke();
-
- // __cb's invoke function could potentially delete itself. We need to check before accessing __cb's member
- if (!__destroyed) {
- // needs to set __destroyed_ pointer to nullptr, otherwise it points to a local variable
- // which is to be destroyed at the end of the loop
- __cb->__destroyed_ = nullptr;
-
- // [stopcallback.cons] If callback is concurrently executing on another thread, then the return
- // from the invocation of callback strongly happens before ([intro.races]) callback is destroyed.
- // this release syncs with the acquire in the remove_callback
- __cb->__completed_.store(true, std::memory_order_release);
- __cb->__completed_.notify_all();
- }
-
- __cb_list_lock.__lock();
- }
-
- return true;
- }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __add_callback(__stop_callback_base* __cb) noexcept {
- // If it is already stop_requested. Do not try to request it again.
- const auto __give_up_trying_to_lock_condition = [__cb](__state_t __state) {
- if ((__state & __stop_requested_bit) != 0) {
- // already stop requested, synchronously run the callback and no need to lock the list again
- __cb->__invoke();
- return true;
- }
- // no stop source. no need to lock the list to add the callback as it can never be invoked
- return (__state >> __stop_source_counter_shift) == 0;
- };
-
- __callback_list_lock __cb_list_lock(__state_, __give_up_trying_to_lock_condition);
-
- if (!__cb_list_lock.__owns_lock()) {
- return false;
- }
-
- __callback_list_.__push_front(__cb);
-
- return true;
- // unlock here: [thread.stoptoken.intro] Registration of a callback synchronizes with the invocation of
- // that callback.
- // Note: this release sync with the acquire in the request_stop' __try_lock_for_request_stop
- }
-
- // called by the destructor of stop_callback
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void __remove_callback(__stop_callback_base* __cb) noexcept {
- __callback_list_lock __cb_list_lock(__state_);
-
- // under below condition, the request_stop call just popped __cb from the list and could execute it now
- bool __potentially_executing_now = __cb->__prev_ == nullptr && !__callback_list_.__is_head(__cb);
-
- if (__potentially_executing_now) {
- auto __requested_thread = __requesting_thread_;
- __cb_list_lock.__unlock();
-
- if (std::this_thread::get_id() != __requested_thread) {
- // [stopcallback.cons] If callback is concurrently executing on another thread, then the return
- // from the invocation of callback strongly happens before ([intro.races]) callback is destroyed.
- __cb->__completed_.wait(false, std::memory_order_acquire);
- } else {
- // The destructor of stop_callback runs on the same thread of the thread that invokes the callback.
- // The callback is potentially invoking its own destuctor. Set the flag to avoid accessing destroyed
- // members on the invoking side
- if (__cb->__destroyed_) {
- *__cb->__destroyed_ = true;
- }
- }
- } else {
- __callback_list_.__remove(__cb);
- }
- }
-
-private:
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI __callback_list_lock __try_lock_for_request_stop() noexcept {
- // If it is already stop_requested, do not try to request stop or lock the list again.
- const auto __lock_fail_condition = [](__state_t __state) { return (__state & __stop_requested_bit) != 0; };
-
- // set locked and requested bit at the same time
- const auto __after_lock_state = [](__state_t __state) {
- return __state | __callback_list_locked_bit | __stop_requested_bit;
- };
-
- // acq because [thread.stoptoken.intro] Registration of a callback synchronizes with the invocation of that
- // callback. We are going to invoke the callback after getting the lock, acquire so that we can see the
- // registration of a callback (and other writes that happens-before the add_callback)
- // Note: the rel (unlock) in the add_callback syncs with this acq
- // rel because [thread.stoptoken.intro] A call to request_stop that returns true synchronizes with a call
- // to stop_requested on an associated stop_token or stop_source object that returns true.
- // We need to make sure that all writes (including user code) before request_stop will be made visible
- // to the threads that waiting for `stop_requested == true`
- // Note: this rel syncs with the acq in `stop_requested`
- const auto __locked_ordering = std::memory_order_acq_rel;
-
- return __callback_list_lock(__state_, __lock_fail_condition, __after_lock_state, __locked_ordering);
- }
-
- template <class _Tp>
- friend struct __intrusive_shared_ptr_traits;
-};
-
-template <class _Tp>
-struct __intrusive_shared_ptr_traits;
-
-template <>
-struct __intrusive_shared_ptr_traits<__stop_state> {
- _LIBCPP_HIDE_FROM_ABI static atomic<uint32_t>& __get_atomic_ref_count(__stop_state& __state) {
- return __state.__ref_count_;
- }
-};
-
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_THREADS)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_STOP_STATE_H
diff --git a/libcxx/include/__cxx03/__stop_token/stop_token.h b/libcxx/include/__cxx03/__stop_token/stop_token.h
deleted file mode 100644
index 64f3e605c7886..0000000000000
--- a/libcxx/include/__cxx03/__stop_token/stop_token.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___STOP_TOKEN_STOP_TOKEN_H
-#define _LIBCPP___CXX03___STOP_TOKEN_STOP_TOKEN_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__stop_token/intrusive_shared_ptr.h>
-#include <__cxx03/__stop_token/stop_state.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-class _LIBCPP_AVAILABILITY_SYNC stop_token {
-public:
- _LIBCPP_HIDE_FROM_ABI stop_token() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI stop_token(const stop_token&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI stop_token(stop_token&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI stop_token& operator=(const stop_token&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI stop_token& operator=(stop_token&&) noexcept = default;
- _LIBCPP_HIDE_FROM_ABI ~stop_token() = default;
-
- _LIBCPP_HIDE_FROM_ABI void swap(stop_token& __other) noexcept { __state_.swap(__other.__state_); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool stop_requested() const noexcept {
- return __state_ != nullptr && __state_->__stop_requested();
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool stop_possible() const noexcept {
- return __state_ != nullptr && __state_->__stop_possible_for_stop_token();
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend bool operator==(const stop_token&, const stop_token&) noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI friend void swap(stop_token& __lhs, stop_token& __rhs) noexcept { __lhs.swap(__rhs); }
-
-private:
- __intrusive_shared_ptr<__stop_state> __state_;
-
- friend class stop_source;
- template <class _Tp>
- friend class stop_callback;
-
- _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {}
-};
-
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___STOP_TOKEN_STOP_TOKEN_H
diff --git a/libcxx/include/__cxx03/__string/char_traits.h b/libcxx/include/__cxx03/__string/char_traits.h
index e962d986b2785..16669009c7c85 100644
--- a/libcxx/include/__cxx03/__string/char_traits.h
+++ b/libcxx/include/__cxx03/__string/char_traits.h
@@ -15,7 +15,6 @@
#include <__cxx03/__algorithm/find_first_of.h>
#include <__cxx03/__algorithm/min.h>
#include <__cxx03/__assert>
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/identity.h>
diff --git a/libcxx/include/__cxx03/__system_error/error_category.h b/libcxx/include/__cxx03/__system_error/error_category.h
index 7f9dd7171ea5c..2f342aaf2d398 100644
--- a/libcxx/include/__cxx03/__system_error/error_category.h
+++ b/libcxx/include/__cxx03/__system_error/error_category.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CATEGORY_H
#define _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CATEGORY_H
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/string>
diff --git a/libcxx/include/__cxx03/__system_error/error_code.h b/libcxx/include/__cxx03/__system_error/error_code.h
index e253f88633d33..5224428788265 100644
--- a/libcxx/include/__cxx03/__system_error/error_code.h
+++ b/libcxx/include/__cxx03/__system_error/error_code.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CODE_H
#define _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CODE_H
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/unary_function.h>
diff --git a/libcxx/include/__cxx03/__system_error/error_condition.h b/libcxx/include/__cxx03/__system_error/error_condition.h
index ba37deaf4fcb6..6c4bf4a1bd1b3 100644
--- a/libcxx/include/__cxx03/__system_error/error_condition.h
+++ b/libcxx/include/__cxx03/__system_error/error_condition.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CONDITION_H
#define _LIBCPP___CXX03___SYSTEM_ERROR_ERROR_CONDITION_H
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/unary_function.h>
diff --git a/libcxx/include/__cxx03/__thread/formatter.h b/libcxx/include/__cxx03/__thread/formatter.h
deleted file mode 100644
index 5d54789ee445c..0000000000000
--- a/libcxx/include/__cxx03/__thread/formatter.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___THREAD_FORMATTER_H
-#define _LIBCPP___CXX03___THREAD_FORMATTER_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__format/concepts.h>
-#include <__cxx03/__format/format_parse_context.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_integral.h>
-#include <__cxx03/__format/parser_std_format_spec.h>
-#include <__cxx03/__thread/id.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/cstdint>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# ifndef _LIBCPP_HAS_NO_THREADS
-
-template <__fmt_char_type _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> {
-public:
- template <class _ParseContext>
- _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
- return __parser_.__parse(__ctx, __format_spec::__fields_fill_align_width);
- }
-
- template <class _FormatContext>
- _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(__thread_id __id, _FormatContext& __ctx) const {
- // In __thread/support/pthread.h, __libcpp_thread_id is either a
- // unsigned long long or a pthread_t.
- //
- // The type of pthread_t is left unspecified in POSIX so it can be any
- // type. The most logical types are an integral or pointer.
- // On Linux systems pthread_t is an unsigned long long.
- // On Apple systems pthread_t is a pointer type.
- //
- // Note the output should match what the stream operator does. Since
- // the ostream operator has been shipped years before this formatter
- // was added to the Standard, this formatter does what the stream
- // operator does. This may require platform specific changes.
-
- using _Tp = decltype(__get_underlying_id(__id));
- using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
- static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
-
- __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
- if constexpr (is_pointer_v<_Tp>) {
- __specs.__std_.__alternate_form_ = true;
- __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
- }
- return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
- }
-
- __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right};
-};
-
-# endif // !_LIBCPP_HAS_NO_THREADS
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 23
-
-#endif // _LIBCPP___CXX03___THREAD_FORMATTER_H
diff --git a/libcxx/include/__cxx03/__thread/id.h b/libcxx/include/__cxx03/__thread/id.h
index 8dcd68bdf39d7..2df18a727086a 100644
--- a/libcxx/include/__cxx03/__thread/id.h
+++ b/libcxx/include/__cxx03/__thread/id.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CXX03___THREAD_ID_H
#define _LIBCPP___CXX03___THREAD_ID_H
-#include <__cxx03/__compare/ordering.h>
#include <__cxx03/__config>
#include <__cxx03/__fwd/functional.h>
#include <__cxx03/__fwd/ostream.h>
diff --git a/libcxx/include/__cxx03/__thread/jthread.h b/libcxx/include/__cxx03/__thread/jthread.h
deleted file mode 100644
index 6272ccaa6f7ce..0000000000000
--- a/libcxx/include/__cxx03/__thread/jthread.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___THREAD_JTHREAD_H
-#define _LIBCPP___CXX03___THREAD_JTHREAD_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__stop_token/stop_source.h>
-#include <__cxx03/__stop_token/stop_token.h>
-#include <__cxx03/__thread/support.h>
-#include <__cxx03/__thread/thread.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-class _LIBCPP_AVAILABILITY_SYNC jthread {
-public:
- // types
- using id = thread::id;
- using native_handle_type = thread::native_handle_type;
-
- // [thread.jthread.cons], constructors, move, and assignment
- _LIBCPP_HIDE_FROM_ABI jthread() noexcept : __stop_source_(std::nostopstate) {}
-
- template <class _Fun, class... _Args>
- _LIBCPP_HIDE_FROM_ABI explicit jthread(_Fun&& __fun, _Args&&... __args)
- requires(!std::is_same_v<remove_cvref_t<_Fun>, jthread>)
- : __stop_source_(),
- __thread_(__init_thread(__stop_source_, std::forward<_Fun>(__fun), std::forward<_Args>(__args)...)) {
- static_assert(is_constructible_v<decay_t<_Fun>, _Fun>);
- static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...));
- static_assert(is_invocable_v<decay_t<_Fun>, decay_t<_Args>...> ||
- is_invocable_v<decay_t<_Fun>, stop_token, decay_t<_Args>...>);
- }
-
- _LIBCPP_HIDE_FROM_ABI ~jthread() {
- if (joinable()) {
- request_stop();
- join();
- }
- }
-
- jthread(const jthread&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI jthread(jthread&&) noexcept = default;
-
- jthread& operator=(const jthread&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI jthread& operator=(jthread&& __other) noexcept {
- if (this != &__other) {
- if (joinable()) {
- request_stop();
- join();
- }
- __stop_source_ = std::move(__other.__stop_source_);
- __thread_ = std::move(__other.__thread_);
- }
-
- return *this;
- }
-
- // [thread.jthread.mem], members
- _LIBCPP_HIDE_FROM_ABI void swap(jthread& __other) noexcept {
- std::swap(__stop_source_, __other.__stop_source_);
- std::swap(__thread_, __other.__thread_);
- }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool joinable() const noexcept { return get_id() != id(); }
-
- _LIBCPP_HIDE_FROM_ABI void join() { __thread_.join(); }
-
- _LIBCPP_HIDE_FROM_ABI void detach() { __thread_.detach(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI id get_id() const noexcept { return __thread_.get_id(); }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return __thread_.native_handle(); }
-
- // [thread.jthread.stop], stop token handling
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI stop_source get_stop_source() noexcept { return __stop_source_; }
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI stop_token get_stop_token() const noexcept { return __stop_source_.get_token(); }
-
- _LIBCPP_HIDE_FROM_ABI bool request_stop() noexcept { return __stop_source_.request_stop(); }
-
- // [thread.jthread.special], specialized algorithms
- _LIBCPP_HIDE_FROM_ABI friend void swap(jthread& __lhs, jthread& __rhs) noexcept { __lhs.swap(__rhs); }
-
- // [thread.jthread.static], static members
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static unsigned int hardware_concurrency() noexcept {
- return thread::hardware_concurrency();
- }
-
-private:
- template <class _Fun, class... _Args>
- _LIBCPP_HIDE_FROM_ABI static thread __init_thread(const stop_source& __ss, _Fun&& __fun, _Args&&... __args) {
- if constexpr (is_invocable_v<decay_t<_Fun>, stop_token, decay_t<_Args>...>) {
- return thread(std::forward<_Fun>(__fun), __ss.get_token(), std::forward<_Args>(__args)...);
- } else {
- return thread(std::forward<_Fun>(__fun), std::forward<_Args>(__args)...);
- }
- }
-
- stop_source __stop_source_;
- thread __thread_;
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___THREAD_JTHREAD_H
diff --git a/libcxx/include/__cxx03/__thread/thread.h b/libcxx/include/__cxx03/__thread/thread.h
index b624a7d46fe24..00528a503a31b 100644
--- a/libcxx/include/__cxx03/__thread/thread.h
+++ b/libcxx/include/__cxx03/__thread/thread.h
@@ -21,7 +21,6 @@
#include <__cxx03/__thread/id.h>
#include <__cxx03/__thread/support.h>
#include <__cxx03/__utility/forward.h>
-#include <__cxx03/tuple>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <__cxx03/locale>
diff --git a/libcxx/include/__cxx03/__tree b/libcxx/include/__cxx03/__tree
index 8982baf18d1a9..aec20a7541b26 100644
--- a/libcxx/include/__cxx03/__tree
+++ b/libcxx/include/__cxx03/__tree
@@ -13,7 +13,6 @@
#include <__cxx03/__algorithm/min.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/next.h>
@@ -25,6 +24,7 @@
#include <__cxx03/__memory/unique_ptr.h>
#include <__cxx03/__type_traits/can_extract_key.h>
#include <__cxx03/__type_traits/conditional.h>
+#include <__cxx03/__type_traits/invoke.h>
#include <__cxx03/__type_traits/is_const.h>
#include <__cxx03/__type_traits/is_constructible.h>
#include <__cxx03/__type_traits/is_nothrow_assignable.h>
diff --git a/libcxx/include/__cxx03/__tuple/ignore.h b/libcxx/include/__cxx03/__tuple/ignore.h
deleted file mode 100644
index 9e00de9a8471d..0000000000000
--- a/libcxx/include/__cxx03/__tuple/ignore.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___TUPLE_IGNORE_H
-#define _LIBCPP___CXX03___TUPLE_IGNORE_H
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifndef _LIBCPP_CXX03_LANG
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-struct __ignore_type {
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const __ignore_type& operator=(const _Tp&) const noexcept {
- return *this;
- }
-};
-
-# if _LIBCPP_STD_VER >= 17
-inline constexpr __ignore_type ignore;
-# else
-constexpr __ignore_type ignore;
-# endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CXX03_LANG
-
-#endif // _LIBCPP___CXX03___TUPLE_IGNORE_H
diff --git a/libcxx/include/__cxx03/__type_traits/common_reference.h b/libcxx/include/__cxx03/__type_traits/common_reference.h
deleted file mode 100644
index 8e1694e14e6ef..0000000000000
--- a/libcxx/include/__cxx03/__type_traits/common_reference.h
+++ /dev/null
@@ -1,193 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___TYPE_TRAITS_COMMON_REFERENCE_H
-#define _LIBCPP___CXX03___TYPE_TRAITS_COMMON_REFERENCE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/copy_cv.h>
-#include <__cxx03/__type_traits/copy_cvref.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// common_reference
-#if _LIBCPP_STD_VER >= 20
-// Let COND_RES(X, Y) be:
-template <class _Xp, class _Yp>
-using __cond_res = decltype(false ? std::declval<_Xp (&)()>()() : std::declval<_Yp (&)()>()());
-
-// Let `XREF(A)` denote a unary alias template `T` such that `T<U>` denotes the same type as `U`
-// with the addition of `A`'s cv and reference qualifiers, for a non-reference cv-unqualified type
-// `U`.
-// [Note: `XREF(A)` is `__xref<A>::template __apply`]
-template <class _Tp>
-struct __xref {
- template <class _Up>
- using __apply = __copy_cvref_t<_Tp, _Up>;
-};
-
-// Given types A and B, let X be remove_reference_t<A>, let Y be remove_reference_t<B>,
-// and let COMMON-REF(A, B) be:
-template <class _Ap, class _Bp, class _Xp = remove_reference_t<_Ap>, class _Yp = remove_reference_t<_Bp>>
-struct __common_ref;
-
-template <class _Xp, class _Yp>
-using __common_ref_t = typename __common_ref<_Xp, _Yp>::__type;
-
-template <class _Xp, class _Yp>
-using __cv_cond_res = __cond_res<__copy_cv_t<_Xp, _Yp>&, __copy_cv_t<_Yp, _Xp>&>;
-
-// If A and B are both lvalue reference types, COMMON-REF(A, B) is
-// COND-RES(COPYCV(X, Y)&, COPYCV(Y, X)&) if that type exists and is a reference type.
-// clang-format off
-template <class _Ap, class _Bp, class _Xp, class _Yp>
- requires
- requires { typename __cv_cond_res<_Xp, _Yp>; } &&
- is_reference_v<__cv_cond_res<_Xp, _Yp>>
-struct __common_ref<_Ap&, _Bp&, _Xp, _Yp> {
- using __type = __cv_cond_res<_Xp, _Yp>;
-};
-// clang-format on
-
-// Otherwise, let C be remove_reference_t<COMMON-REF(X&, Y&)>&&. ...
-template <class _Xp, class _Yp>
-using __common_ref_C = remove_reference_t<__common_ref_t<_Xp&, _Yp&>>&&;
-
-// .... If A and B are both rvalue reference types, C is well-formed, and
-// is_convertible_v<A, C> && is_convertible_v<B, C> is true, then COMMON-REF(A, B) is C.
-// clang-format off
-template <class _Ap, class _Bp, class _Xp, class _Yp>
- requires
- requires { typename __common_ref_C<_Xp, _Yp>; } &&
- is_convertible_v<_Ap&&, __common_ref_C<_Xp, _Yp>> &&
- is_convertible_v<_Bp&&, __common_ref_C<_Xp, _Yp>>
-struct __common_ref<_Ap&&, _Bp&&, _Xp, _Yp> {
- using __type = __common_ref_C<_Xp, _Yp>;
-};
-// clang-format on
-
-// Otherwise, let D be COMMON-REF(const X&, Y&). ...
-template <class _Tp, class _Up>
-using __common_ref_D = __common_ref_t<const _Tp&, _Up&>;
-
-// ... If A is an rvalue reference and B is an lvalue reference and D is well-formed and
-// is_convertible_v<A, D> is true, then COMMON-REF(A, B) is D.
-// clang-format off
-template <class _Ap, class _Bp, class _Xp, class _Yp>
- requires
- requires { typename __common_ref_D<_Xp, _Yp>; } &&
- is_convertible_v<_Ap&&, __common_ref_D<_Xp, _Yp>>
-struct __common_ref<_Ap&&, _Bp&, _Xp, _Yp> {
- using __type = __common_ref_D<_Xp, _Yp>;
-};
-// clang-format on
-
-// Otherwise, if A is an lvalue reference and B is an rvalue reference, then
-// COMMON-REF(A, B) is COMMON-REF(B, A).
-template <class _Ap, class _Bp, class _Xp, class _Yp>
-struct __common_ref<_Ap&, _Bp&&, _Xp, _Yp> : __common_ref<_Bp&&, _Ap&> {};
-
-// Otherwise, COMMON-REF(A, B) is ill-formed.
-template <class _Ap, class _Bp, class _Xp, class _Yp>
-struct __common_ref {};
-
-// Note C: For the common_reference trait applied to a parameter pack [...]
-
-template <class...>
-struct common_reference;
-
-template <class... _Types>
-using common_reference_t = typename common_reference<_Types...>::type;
-
-// bullet 1 - sizeof...(T) == 0
-template <>
-struct common_reference<> {};
-
-// bullet 2 - sizeof...(T) == 1
-template <class _Tp>
-struct common_reference<_Tp> {
- using type = _Tp;
-};
-
-// bullet 3 - sizeof...(T) == 2
-template <class _Tp, class _Up>
-struct __common_reference_sub_bullet3;
-template <class _Tp, class _Up>
-struct __common_reference_sub_bullet2 : __common_reference_sub_bullet3<_Tp, _Up> {};
-template <class _Tp, class _Up>
-struct __common_reference_sub_bullet1 : __common_reference_sub_bullet2<_Tp, _Up> {};
-
-// sub-bullet 1 - If T1 and T2 are reference types and COMMON-REF(T1, T2) is well-formed, then
-// the member typedef `type` denotes that type.
-template <class _Tp, class _Up>
-struct common_reference<_Tp, _Up> : __common_reference_sub_bullet1<_Tp, _Up> {};
-
-template <class _Tp, class _Up>
- requires is_reference_v<_Tp> && is_reference_v<_Up> && requires { typename __common_ref_t<_Tp, _Up>; }
-struct __common_reference_sub_bullet1<_Tp, _Up> {
- using type = __common_ref_t<_Tp, _Up>;
-};
-
-// sub-bullet 2 - Otherwise, if basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>, XREF(T1), XREF(T2)>::type
-// is well-formed, then the member typedef `type` denotes that type.
-template <class, class, template <class> class, template <class> class>
-struct basic_common_reference {};
-
-template <class _Tp, class _Up>
-using __basic_common_reference_t =
- typename basic_common_reference<remove_cvref_t<_Tp>,
- remove_cvref_t<_Up>,
- __xref<_Tp>::template __apply,
- __xref<_Up>::template __apply>::type;
-
-template <class _Tp, class _Up>
- requires requires { typename __basic_common_reference_t<_Tp, _Up>; }
-struct __common_reference_sub_bullet2<_Tp, _Up> {
- using type = __basic_common_reference_t<_Tp, _Up>;
-};
-
-// sub-bullet 3 - Otherwise, if COND-RES(T1, T2) is well-formed,
-// then the member typedef `type` denotes that type.
-template <class _Tp, class _Up>
- requires requires { typename __cond_res<_Tp, _Up>; }
-struct __common_reference_sub_bullet3<_Tp, _Up> {
- using type = __cond_res<_Tp, _Up>;
-};
-
-// sub-bullet 4 & 5 - Otherwise, if common_type_t<T1, T2> is well-formed,
-// then the member typedef `type` denotes that type.
-// - Otherwise, there shall be no member `type`.
-template <class _Tp, class _Up>
-struct __common_reference_sub_bullet3 : common_type<_Tp, _Up> {};
-
-// bullet 4 - If there is such a type `C`, the member typedef type shall denote the same type, if
-// any, as `common_reference_t<C, Rest...>`.
-template <class _Tp, class _Up, class _Vp, class... _Rest>
- requires requires { typename common_reference_t<_Tp, _Up>; }
-struct common_reference<_Tp, _Up, _Vp, _Rest...> : common_reference<common_reference_t<_Tp, _Up>, _Vp, _Rest...> {};
-
-// bullet 5 - Otherwise, there shall be no member `type`.
-template <class...>
-struct common_reference {};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___TYPE_TRAITS_COMMON_REFERENCE_H
diff --git a/libcxx/include/__cxx03/__type_traits/has_unique_object_representation.h b/libcxx/include/__cxx03/__type_traits/has_unique_object_representation.h
deleted file mode 100644
index 8abd31973d9d2..0000000000000
--- a/libcxx/include/__cxx03/__type_traits/has_unique_object_representation.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
-#define _LIBCPP___CXX03___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/remove_all_extents.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
- // TODO: We work around a Clang and GCC bug in __has_unique_object_representations by using remove_all_extents
- // even though it should not be necessary. This was reported to the compilers:
- // - Clang: https://github.com/llvm/llvm-project/issues/95311
- // - GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115476
- // remove_all_extents_t can be removed once all the compilers we support have fixed this bug.
- : public integral_constant<bool, __has_unique_object_representations(remove_all_extents_t<_Tp>)> {};
-
-template <class _Tp>
-inline constexpr bool has_unique_object_representations_v = __has_unique_object_representations(_Tp);
-
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
diff --git a/libcxx/include/__cxx03/__type_traits/is_aggregate.h b/libcxx/include/__cxx03/__type_traits/is_aggregate.h
deleted file mode 100644
index 0d95780859ca8..0000000000000
--- a/libcxx/include/__cxx03/__type_traits/is_aggregate.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___TYPE_TRAITS_IS_AGGREGATE_H
-#define _LIBCPP___CXX03___TYPE_TRAITS_IS_AGGREGATE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__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
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
-
-template <class _Tp>
-inline constexpr bool is_aggregate_v = __is_aggregate(_Tp);
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___TYPE_TRAITS_IS_AGGREGATE_H
diff --git a/libcxx/include/__cxx03/__type_traits/is_nothrow_convertible.h b/libcxx/include/__cxx03/__type_traits/is_nothrow_convertible.h
deleted file mode 100644
index c62e6ccaf9fa1..0000000000000
--- a/libcxx/include/__cxx03/__type_traits/is_nothrow_convertible.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
-#define _LIBCPP___CXX03___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/disjunction.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/lazy.h>
-#include <__cxx03/__utility/declval.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-# if __has_builtin(__is_nothrow_convertible)
-
-template <class _Tp, class _Up>
-struct is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {};
-
-template <class _Tp, class _Up>
-inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up);
-
-# else // __has_builtin(__is_nothrow_convertible)
-
-template <typename _Tp>
-void __test_noexcept(_Tp) noexcept;
-
-template <typename _Fm, typename _To>
-bool_constant<noexcept(std::__test_noexcept<_To>(std::declval<_Fm>()))> __is_nothrow_convertible_test();
-
-template <typename _Fm, typename _To>
-struct __is_nothrow_convertible_helper : decltype(__is_nothrow_convertible_test<_Fm, _To>()) {};
-
-template <typename _Fm, typename _To>
-struct is_nothrow_convertible
- : _Or<_And<is_void<_To>, is_void<_Fm>>,
- _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To> > >::type {};
-
-template <typename _Fm, typename _To>
-inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
-
-# endif // __has_builtin(__is_nothrow_convertible)
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_H
diff --git a/libcxx/include/__cxx03/__type_traits/result_of.h b/libcxx/include/__cxx03/__type_traits/result_of.h
index 36d4180346547..5f04244b5a131 100644
--- a/libcxx/include/__cxx03/__type_traits/result_of.h
+++ b/libcxx/include/__cxx03/__type_traits/result_of.h
@@ -10,7 +10,7 @@
#define _LIBCPP___CXX03___TYPE_TRAITS_RESULT_OF_H
#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
+#include <__cxx03/__type_traits/invoke.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__cxx03/__utility/as_const.h b/libcxx/include/__cxx03/__utility/as_const.h
deleted file mode 100644
index ba1b67216f1ce..0000000000000
--- a/libcxx/include/__cxx03/__utility/as_const.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___UTILITY_AS_CONST_H
-#define _LIBCPP___CXX03___UTILITY_AS_CONST_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/add_const.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept {
- return __t;
-}
-
-template <class _Tp>
-void as_const(const _Tp&&) = delete;
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___UTILITY_AS_CONST_H
diff --git a/libcxx/include/__cxx03/__utility/cmp.h b/libcxx/include/__cxx03/__utility/cmp.h
deleted file mode 100644
index afb4d83a2a295..0000000000000
--- a/libcxx/include/__cxx03/__utility/cmp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___UTILITY_CMP_H
-#define _LIBCPP___CXX03___UTILITY_CMP_H
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_signed.h>
-#include <__cxx03/__type_traits/make_unsigned.h>
-#include <__cxx03/limits>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
- if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
- return __t == __u;
- else if constexpr (is_signed_v<_Tp>)
- return __t < 0 ? false : make_unsigned_t<_Tp>(__t) == __u;
- else
- return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
- return !std::cmp_equal(__t, __u);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
- if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
- return __t < __u;
- else if constexpr (is_signed_v<_Tp>)
- return __t < 0 ? true : make_unsigned_t<_Tp>(__t) < __u;
- else
- return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
- return std::cmp_less(__u, __t);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
- return !std::cmp_greater(__t, __u);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
- return !std::cmp_less(__t, __u);
-}
-
-template <__libcpp_integer _Tp, __libcpp_integer _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
- return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
- std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
-}
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___UTILITY_CMP_H
diff --git a/libcxx/include/__cxx03/__utility/exception_guard.h b/libcxx/include/__cxx03/__utility/exception_guard.h
index 2cdb9b41cd0ed..a72f77b4edd12 100644
--- a/libcxx/include/__cxx03/__utility/exception_guard.h
+++ b/libcxx/include/__cxx03/__utility/exception_guard.h
@@ -12,7 +12,6 @@
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/exchange.h>
#include <__cxx03/__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__cxx03/__utility/exchange.h b/libcxx/include/__cxx03/__utility/exchange.h
deleted file mode 100644
index 682e7d78e65d2..0000000000000
--- a/libcxx/include/__cxx03/__utility/exchange.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___UTILITY_EXCHANGE_H
-#define _LIBCPP___CXX03___UTILITY_EXCHANGE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 14
-template <class _T1, class _T2 = _T1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
- is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
- _T1 __old_value = std::move(__obj);
- __obj = std::forward<_T2>(__new_value);
- return __old_value;
-}
-#endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03___UTILITY_EXCHANGE_H
diff --git a/libcxx/include/__cxx03/__utility/forward_like.h b/libcxx/include/__cxx03/__utility/forward_like.h
deleted file mode 100644
index 989a76ed5b102..0000000000000
--- a/libcxx/include/__cxx03/__utility/forward_like.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___UTILITY_FORWARD_LIKE_H
-#define _LIBCPP___CXX03___UTILITY_FORWARD_LIKE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 23
-
-template <class _Ap, class _Bp>
-using _CopyConst = _If<is_const_v<_Ap>, const _Bp, _Bp>;
-
-template <class _Ap, class _Bp>
-using _OverrideRef = _If<is_rvalue_reference_v<_Ap>, remove_reference_t<_Bp>&&, _Bp&>;
-
-template <class _Ap, class _Bp>
-using _ForwardLike = _OverrideRef<_Ap&&, _CopyConst<remove_reference_t<_Ap>, remove_reference_t<_Bp>>>;
-
-template <class _Tp, class _Up>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
-forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept -> _ForwardLike<_Tp, _Up> {
- return static_cast<_ForwardLike<_Tp, _Up>>(__ux);
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___UTILITY_FORWARD_LIKE_H
diff --git a/libcxx/include/__cxx03/__utility/in_place.h b/libcxx/include/__cxx03/__utility/in_place.h
deleted file mode 100644
index 2ab0be25579b8..0000000000000
--- a/libcxx/include/__cxx03/__utility/in_place.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03___UTILITY_IN_PLACE_H
-#define _LIBCPP___CXX03___UTILITY_IN_PLACE_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-struct _LIBCPP_EXPORTED_FROM_ABI in_place_t {
- explicit in_place_t() = default;
-};
-inline constexpr in_place_t in_place{};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS in_place_type_t {
- _LIBCPP_HIDE_FROM_ABI explicit in_place_type_t() = default;
-};
-template <class _Tp>
-inline constexpr in_place_type_t<_Tp> in_place_type{};
-
-template <size_t _Idx>
-struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
- _LIBCPP_HIDE_FROM_ABI explicit in_place_index_t() = default;
-};
-template <size_t _Idx>
-inline constexpr in_place_index_t<_Idx> in_place_index{};
-
-template <class _Tp>
-struct __is_inplace_type_imp : false_type {};
-template <class _Tp>
-struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
-
-template <class _Tp>
-using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
-
-template <class _Tp>
-struct __is_inplace_index_imp : false_type {};
-template <size_t _Idx>
-struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
-
-template <class _Tp>
-using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___UTILITY_IN_PLACE_H
diff --git a/libcxx/include/__cxx03/__utility/pair.h b/libcxx/include/__cxx03/__utility/pair.h
index 496fbbba675a4..d8e38bd02248e 100644
--- a/libcxx/include/__cxx03/__utility/pair.h
+++ b/libcxx/include/__cxx03/__utility/pair.h
@@ -9,9 +9,6 @@
#ifndef _LIBCPP___CXX03___UTILITY_PAIR_H
#define _LIBCPP___CXX03___UTILITY_PAIR_H
-#include <__cxx03/__compare/common_comparison_category.h>
-#include <__cxx03/__compare/synth_three_way.h>
-#include <__cxx03/__concepts/different_from.h>
#include <__cxx03/__config>
#include <__cxx03/__fwd/array.h>
#include <__cxx03/__fwd/pair.h>
@@ -21,7 +18,6 @@
#include <__cxx03/__tuple/tuple_indices.h>
#include <__cxx03/__tuple/tuple_like_no_subrange.h>
#include <__cxx03/__tuple/tuple_size.h>
-#include <__cxx03/__type_traits/common_reference.h>
#include <__cxx03/__type_traits/common_type.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/decay.h>
diff --git a/libcxx/include/__cxx03/__utility/to_underlying.h b/libcxx/include/__cxx03/__utility/to_underlying.h
deleted file mode 100644
index 9006012f5a19e..0000000000000
--- a/libcxx/include/__cxx03/__utility/to_underlying.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03___UTILITY_TO_UNDERLYING_H
-#define _LIBCPP___CXX03___UTILITY_TO_UNDERLYING_H
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/underlying_type.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#ifndef _LIBCPP_CXX03_LANG
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type __to_underlying(_Tp __val) noexcept {
- return static_cast<typename underlying_type<_Tp>::type>(__val);
-}
-#endif // !_LIBCPP_CXX03_LANG
-
-#if _LIBCPP_STD_VER >= 23
-template <class _Tp>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept {
- return std::__to_underlying(__val);
-}
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03___UTILITY_TO_UNDERLYING_H
diff --git a/libcxx/include/__cxx03/algorithm b/libcxx/include/__cxx03/algorithm
index 8eff4d152adb2..5aecfd965dc0a 100644
--- a/libcxx/include/__cxx03/algorithm
+++ b/libcxx/include/__cxx03/algorithm
@@ -1904,127 +1904,8 @@ template <class BidirectionalIterator, class Compare>
#include <__cxx03/__algorithm/unique_copy.h>
#include <__cxx03/__algorithm/upper_bound.h>
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__algorithm/clamp.h>
-# include <__cxx03/__algorithm/for_each_n.h>
-# include <__cxx03/__algorithm/pstl.h>
-# include <__cxx03/__algorithm/sample.h>
-#endif // _LIBCPP_STD_VER >= 17
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__algorithm/in_found_result.h>
-# include <__cxx03/__algorithm/in_fun_result.h>
-# include <__cxx03/__algorithm/in_in_out_result.h>
-# include <__cxx03/__algorithm/in_in_result.h>
-# include <__cxx03/__algorithm/in_out_out_result.h>
-# include <__cxx03/__algorithm/in_out_result.h>
-# include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
-# include <__cxx03/__algorithm/min_max_result.h>
-# include <__cxx03/__algorithm/ranges_adjacent_find.h>
-# include <__cxx03/__algorithm/ranges_all_of.h>
-# include <__cxx03/__algorithm/ranges_any_of.h>
-# include <__cxx03/__algorithm/ranges_binary_search.h>
-# include <__cxx03/__algorithm/ranges_clamp.h>
-# include <__cxx03/__algorithm/ranges_contains.h>
-# include <__cxx03/__algorithm/ranges_copy.h>
-# include <__cxx03/__algorithm/ranges_copy_backward.h>
-# include <__cxx03/__algorithm/ranges_copy_if.h>
-# include <__cxx03/__algorithm/ranges_copy_n.h>
-# include <__cxx03/__algorithm/ranges_count.h>
-# include <__cxx03/__algorithm/ranges_count_if.h>
-# include <__cxx03/__algorithm/ranges_equal.h>
-# include <__cxx03/__algorithm/ranges_equal_range.h>
-# include <__cxx03/__algorithm/ranges_fill.h>
-# include <__cxx03/__algorithm/ranges_fill_n.h>
-# include <__cxx03/__algorithm/ranges_find.h>
-# include <__cxx03/__algorithm/ranges_find_end.h>
-# include <__cxx03/__algorithm/ranges_find_first_of.h>
-# include <__cxx03/__algorithm/ranges_find_if.h>
-# include <__cxx03/__algorithm/ranges_find_if_not.h>
-# include <__cxx03/__algorithm/ranges_for_each.h>
-# include <__cxx03/__algorithm/ranges_for_each_n.h>
-# include <__cxx03/__algorithm/ranges_generate.h>
-# include <__cxx03/__algorithm/ranges_generate_n.h>
-# include <__cxx03/__algorithm/ranges_includes.h>
-# include <__cxx03/__algorithm/ranges_inplace_merge.h>
-# include <__cxx03/__algorithm/ranges_is_heap.h>
-# include <__cxx03/__algorithm/ranges_is_heap_until.h>
-# include <__cxx03/__algorithm/ranges_is_partitioned.h>
-# include <__cxx03/__algorithm/ranges_is_permutation.h>
-# include <__cxx03/__algorithm/ranges_is_sorted.h>
-# include <__cxx03/__algorithm/ranges_is_sorted_until.h>
-# include <__cxx03/__algorithm/ranges_lexicographical_compare.h>
-# include <__cxx03/__algorithm/ranges_lower_bound.h>
-# include <__cxx03/__algorithm/ranges_make_heap.h>
-# include <__cxx03/__algorithm/ranges_max.h>
-# include <__cxx03/__algorithm/ranges_max_element.h>
-# include <__cxx03/__algorithm/ranges_merge.h>
-# include <__cxx03/__algorithm/ranges_min.h>
-# include <__cxx03/__algorithm/ranges_min_element.h>
-# include <__cxx03/__algorithm/ranges_minmax.h>
-# include <__cxx03/__algorithm/ranges_minmax_element.h>
-# include <__cxx03/__algorithm/ranges_mismatch.h>
-# include <__cxx03/__algorithm/ranges_move.h>
-# include <__cxx03/__algorithm/ranges_move_backward.h>
-# include <__cxx03/__algorithm/ranges_next_permutation.h>
-# include <__cxx03/__algorithm/ranges_none_of.h>
-# include <__cxx03/__algorithm/ranges_nth_element.h>
-# include <__cxx03/__algorithm/ranges_partial_sort.h>
-# include <__cxx03/__algorithm/ranges_partial_sort_copy.h>
-# include <__cxx03/__algorithm/ranges_partition.h>
-# include <__cxx03/__algorithm/ranges_partition_copy.h>
-# include <__cxx03/__algorithm/ranges_partition_point.h>
-# include <__cxx03/__algorithm/ranges_pop_heap.h>
-# include <__cxx03/__algorithm/ranges_prev_permutation.h>
-# include <__cxx03/__algorithm/ranges_push_heap.h>
-# include <__cxx03/__algorithm/ranges_remove.h>
-# include <__cxx03/__algorithm/ranges_remove_copy.h>
-# include <__cxx03/__algorithm/ranges_remove_copy_if.h>
-# include <__cxx03/__algorithm/ranges_remove_if.h>
-# include <__cxx03/__algorithm/ranges_replace.h>
-# include <__cxx03/__algorithm/ranges_replace_copy.h>
-# include <__cxx03/__algorithm/ranges_replace_copy_if.h>
-# include <__cxx03/__algorithm/ranges_replace_if.h>
-# include <__cxx03/__algorithm/ranges_reverse.h>
-# include <__cxx03/__algorithm/ranges_reverse_copy.h>
-# include <__cxx03/__algorithm/ranges_rotate.h>
-# include <__cxx03/__algorithm/ranges_rotate_copy.h>
-# include <__cxx03/__algorithm/ranges_sample.h>
-# include <__cxx03/__algorithm/ranges_search.h>
-# include <__cxx03/__algorithm/ranges_search_n.h>
-# include <__cxx03/__algorithm/ranges_set_difference.h>
-# include <__cxx03/__algorithm/ranges_set_intersection.h>
-# include <__cxx03/__algorithm/ranges_set_symmetric_difference.h>
-# include <__cxx03/__algorithm/ranges_set_union.h>
-# include <__cxx03/__algorithm/ranges_shuffle.h>
-# include <__cxx03/__algorithm/ranges_sort.h>
-# include <__cxx03/__algorithm/ranges_sort_heap.h>
-# include <__cxx03/__algorithm/ranges_stable_partition.h>
-# include <__cxx03/__algorithm/ranges_stable_sort.h>
-# include <__cxx03/__algorithm/ranges_swap_ranges.h>
-# include <__cxx03/__algorithm/ranges_transform.h>
-# include <__cxx03/__algorithm/ranges_unique.h>
-# include <__cxx03/__algorithm/ranges_unique_copy.h>
-# include <__cxx03/__algorithm/ranges_upper_bound.h>
-# include <__cxx03/__algorithm/shift_left.h>
-# include <__cxx03/__algorithm/shift_right.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__algorithm/fold.h>
-# include <__cxx03/__algorithm/ranges_contains_subrange.h>
-# include <__cxx03/__algorithm/ranges_ends_with.h>
-# include <__cxx03/__algorithm/ranges_find_last.h>
-# include <__cxx03/__algorithm/ranges_starts_with.h>
-#endif // _LIBCPP_STD_VER >= 23
-
#include <__cxx03/version>
-// standard-mandated includes
-
-// [algorithm.syn]
-#include <__cxx03/initializer_list>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -2035,8 +1916,6 @@ template <class BidirectionalIterator, class Compare>
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/bit>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
# include <__cxx03/iterator>
diff --git a/libcxx/include/__cxx03/any b/libcxx/include/__cxx03/any
deleted file mode 100644
index 01289c5c4f0a0..0000000000000
--- a/libcxx/include/__cxx03/any
+++ /dev/null
@@ -1,614 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_ANY
-#define _LIBCPP___CXX03_ANY
-
-/*
- any synopsis
-
-namespace std {
-
- class bad_any_cast : public bad_cast
- {
- public:
- virtual const char* what() const noexcept;
- };
-
- class any
- {
- public:
-
- // 6.3.1 any construct/destruct
- any() noexcept;
-
- any(const any& other);
- any(any&& other) noexcept;
-
- template <class ValueType>
- any(ValueType&& value);
-
- ~any();
-
- // 6.3.2 any assignments
- any& operator=(const any& rhs);
- any& operator=(any&& rhs) noexcept;
-
- template <class ValueType>
- any& operator=(ValueType&& rhs);
-
- // 6.3.3 any modifiers
- template <class ValueType, class... Args>
- decay_t<ValueType>& emplace(Args&&... args);
- template <class ValueType, class U, class... Args>
- decay_t<ValueType>& emplace(initializer_list<U>, Args&&...);
- void reset() noexcept;
- void swap(any& rhs) noexcept;
-
- // 6.3.4 any observers
- bool has_value() const noexcept;
- const type_info& type() const noexcept;
- };
-
- // 6.4 Non-member functions
- void swap(any& x, any& y) noexcept;
-
- template <class T, class ...Args>
- any make_any(Args&& ...args);
- template <class T, class U, class ...Args>
- any make_any(initializer_list<U>, Args&& ...args);
-
- template<class ValueType>
- ValueType any_cast(const any& operand);
- template<class ValueType>
- ValueType any_cast(any& operand);
- template<class ValueType>
- ValueType any_cast(any&& operand);
-
- template<class ValueType>
- const ValueType* any_cast(const any* operand) noexcept;
- template<class ValueType>
- ValueType* any_cast(any* operand) noexcept;
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory/allocator_destructor.h>
-#include <__cxx03/__memory/allocator_traits.h>
-#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__type_traits/add_const.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/aligned_storage.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_function.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/unreachable.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/initializer_list>
-#include <__cxx03/typeinfo>
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-namespace std {
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast {
-public:
- const char* what() const _NOEXCEPT override;
-};
-} // namespace std
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_any_cast();
-# else
- _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
-# endif
-}
-
-// Forward declarations
-class _LIBCPP_TEMPLATE_VIS any;
-
-template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
-
-template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
-
-namespace __any_imp {
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-using _Buffer = aligned_storage_t<3 * sizeof(void*), alignof(void*)>;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-template <class _Tp>
-using _IsSmallObject =
- integral_constant<bool,
- sizeof(_Tp) <= sizeof(_Buffer) && alignof(_Buffer) % alignof(_Tp) == 0 &&
- is_nothrow_move_constructible<_Tp>::value >;
-
-enum class _Action { _Destroy, _Copy, _Move, _Get, _TypeInfo };
-
-template <class _Tp>
-struct _SmallHandler;
-template <class _Tp>
-struct _LargeHandler;
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo {
- static constexpr int __id = 0;
-};
-template <class _Tp>
-constexpr int __unique_typeinfo<_Tp>::__id;
-
-template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {
- return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
-}
-
-template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
-# if !defined(_LIBCPP_HAS_NO_RTTI)
- if (__id && *__id == typeid(_Tp))
- return true;
-# endif
- return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
-}
-
-template <class _Tp>
-using _Handler = conditional_t< _IsSmallObject<_Tp>::value, _SmallHandler<_Tp>, _LargeHandler<_Tp>>;
-
-} // namespace __any_imp
-
-class _LIBCPP_TEMPLATE_VIS any {
-public:
- // construct/destruct
- _LIBCPP_HIDE_FROM_ABI constexpr any() _NOEXCEPT : __h_(nullptr) {}
-
- _LIBCPP_HIDE_FROM_ABI any(any const& __other) : __h_(nullptr) {
- if (__other.__h_)
- __other.__call(_Action::_Copy, this);
- }
-
- _LIBCPP_HIDE_FROM_ABI any(any&& __other) _NOEXCEPT : __h_(nullptr) {
- if (__other.__h_)
- __other.__call(_Action::_Move, this);
- }
-
- template < class _ValueType,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value &&
- is_copy_constructible<_Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value);
-
- template <class _ValueType,
- class... _Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value > >
- _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
-
- template <class _ValueType,
- class _Up,
- class... _Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
-
- _LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); }
-
- // assignments
- _LIBCPP_HIDE_FROM_ABI any& operator=(any const& __rhs) {
- any(__rhs).swap(*this);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI any& operator=(any&& __rhs) _NOEXCEPT {
- any(std::move(__rhs)).swap(*this);
- return *this;
- }
-
- template < class _ValueType,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< !is_same<_Tp, any>::value && is_copy_constructible<_Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI any& operator=(_ValueType&& __rhs);
-
- template <class _ValueType,
- class... _Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< is_constructible<_Tp, _Args...>::value && is_copy_constructible<_Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI _Tp& emplace(_Args&&...);
-
- template <class _ValueType,
- class _Up,
- class... _Args,
- class _Tp = decay_t<_ValueType>,
- class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value> >
- _LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...);
-
- // 6.3.3 any modifiers
- _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT {
- if (__h_)
- this->__call(_Action::_Destroy);
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(any& __rhs) _NOEXCEPT;
-
- // 6.3.4 any observers
- _LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
-
-# if !defined(_LIBCPP_HAS_NO_RTTI)
- _LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
- if (__h_) {
- return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
- } else {
- return typeid(void);
- }
- }
-# endif
-
-private:
- typedef __any_imp::_Action _Action;
- using _HandleFuncPtr = void* (*)(_Action, any const*, any*, const type_info*, const void* __fallback_info);
-
- union _Storage {
- _LIBCPP_HIDE_FROM_ABI constexpr _Storage() : __ptr(nullptr) {}
- void* __ptr;
- __any_imp::_Buffer __buf;
- };
-
- _LIBCPP_HIDE_FROM_ABI void*
- __call(_Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr)
- const {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
-
- _LIBCPP_HIDE_FROM_ABI void* __call(
- _Action __a, any* __other = nullptr, type_info const* __info = nullptr, const void* __fallback_info = nullptr) {
- return __h_(__a, this, __other, __info, __fallback_info);
- }
-
- template <class>
- friend struct __any_imp::_SmallHandler;
- template <class>
- friend struct __any_imp::_LargeHandler;
-
- template <class _ValueType>
- friend add_pointer_t<add_const_t<_ValueType>> any_cast(any const*) _NOEXCEPT;
-
- template <class _ValueType>
- friend add_pointer_t<_ValueType> any_cast(any*) _NOEXCEPT;
-
- _HandleFuncPtr __h_ = nullptr;
- _Storage __s_;
-};
-
-namespace __any_imp {
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS _SmallHandler {
- _LIBCPP_HIDE_FROM_ABI static void*
- __handle(_Action __act, any const* __this, any* __other, type_info const* __info, const void* __fallback_info) {
- switch (__act) {
- case _Action::_Destroy:
- __destroy(const_cast<any&>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any&>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any&>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp* __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s_.__buf));
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__h_ = &_SmallHandler::__handle;
- return *__ret;
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp* __p = static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf));
- _ATraits::destroy(__a, __p);
- __this.__h_ = nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
- _SmallHandler::__create(__dest, *static_cast<_Tp const*>(static_cast<void const*>(&__this.__s_.__buf)));
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
- _SmallHandler::__create(__dest, std::move(*static_cast<_Tp*>(static_cast<void*>(&__this.__s_.__buf))));
- __destroy(__this);
- }
-
- _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, const void* __fallback_id) {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_id))
- return static_cast<void*>(&__this.__s_.__buf);
- return nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
-# if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
-# else
- return nullptr;
-# endif
- }
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS _LargeHandler {
- _LIBCPP_HIDE_FROM_ABI static void*
- __handle(_Action __act, any const* __this, any* __other, type_info const* __info, void const* __fallback_info) {
- switch (__act) {
- case _Action::_Destroy:
- __destroy(const_cast<any&>(*__this));
- return nullptr;
- case _Action::_Copy:
- __copy(*__this, *__other);
- return nullptr;
- case _Action::_Move:
- __move(const_cast<any&>(*__this), *__other);
- return nullptr;
- case _Action::_Get:
- return __get(const_cast<any&>(*__this), __info, __fallback_info);
- case _Action::_TypeInfo:
- return __type_info();
- }
- __libcpp_unreachable();
- }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI static _Tp& __create(any& __dest, _Args&&... __args) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- typedef __allocator_destructor<_Alloc> _Dp;
- _Alloc __a;
- unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
- _Tp* __ret = __hold.get();
- _ATraits::construct(__a, __ret, std::forward<_Args>(__args)...);
- __dest.__s_.__ptr = __hold.release();
- __dest.__h_ = &_LargeHandler::__handle;
- return *__ret;
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI static void __destroy(any& __this) {
- typedef allocator<_Tp> _Alloc;
- typedef allocator_traits<_Alloc> _ATraits;
- _Alloc __a;
- _Tp* __p = static_cast<_Tp*>(__this.__s_.__ptr);
- _ATraits::destroy(__a, __p);
- _ATraits::deallocate(__a, __p, 1);
- __this.__h_ = nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __copy(any const& __this, any& __dest) {
- _LargeHandler::__create(__dest, *static_cast<_Tp const*>(__this.__s_.__ptr));
- }
-
- _LIBCPP_HIDE_FROM_ABI static void __move(any& __this, any& __dest) {
- __dest.__s_.__ptr = __this.__s_.__ptr;
- __dest.__h_ = &_LargeHandler::__handle;
- __this.__h_ = nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static void* __get(any& __this, type_info const* __info, void const* __fallback_info) {
- if (__any_imp::__compare_typeid<_Tp>(__info, __fallback_info))
- return static_cast<void*>(__this.__s_.__ptr);
- return nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI static void* __type_info() {
-# if !defined(_LIBCPP_HAS_NO_RTTI)
- return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
-# else
- return nullptr;
-# endif
- }
-};
-
-} // namespace __any_imp
-
-template <class _ValueType, class _Tp, class>
-any::any(_ValueType&& __v) : __h_(nullptr) {
- __any_imp::_Handler<_Tp>::__create(*this, std::forward<_ValueType>(__v));
-}
-
-template <class _ValueType, class... _Args, class _Tp, class>
-any::any(in_place_type_t<_ValueType>, _Args&&... __args) {
- __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
-}
-
-template <class _ValueType, class _Up, class... _Args, class _Tp, class>
-any::any(in_place_type_t<_ValueType>, initializer_list<_Up> __il, _Args&&... __args) {
- __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
-}
-
-template <class _ValueType, class, class>
-inline _LIBCPP_HIDE_FROM_ABI any& any::operator=(_ValueType&& __v) {
- any(std::forward<_ValueType>(__v)).swap(*this);
- return *this;
-}
-
-template <class _ValueType, class... _Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(_Args&&... __args) {
- reset();
- return __any_imp::_Handler<_Tp>::__create(*this, std::forward<_Args>(__args)...);
-}
-
-template <class _ValueType, class _Up, class... _Args, class _Tp, class>
-inline _LIBCPP_HIDE_FROM_ABI _Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
- reset();
- return __any_imp::_Handler<_Tp>::__create(*this, __il, std::forward<_Args>(__args)...);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI void any::swap(any& __rhs) _NOEXCEPT {
- if (this == &__rhs)
- return;
- if (__h_ && __rhs.__h_) {
- any __tmp;
- __rhs.__call(_Action::_Move, &__tmp);
- this->__call(_Action::_Move, &__rhs);
- __tmp.__call(_Action::_Move, this);
- } else if (__h_) {
- this->__call(_Action::_Move, &__rhs);
- } else if (__rhs.__h_) {
- __rhs.__call(_Action::_Move, this);
- }
-}
-
-// 6.4 Non-member functions
-
-inline _LIBCPP_HIDE_FROM_ABI void swap(any& __lhs, any& __rhs) _NOEXCEPT { __lhs.swap(__rhs); }
-
-template <class _Tp, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI any make_any(_Args&&... __args) {
- return any(in_place_type<_Tp>, std::forward<_Args>(__args)...);
-}
-
-template <class _Tp, class _Up, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI any make_any(initializer_list<_Up> __il, _Args&&... __args) {
- return any(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
-}
-
-template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any const& __v) {
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType const&>::value,
- "ValueType is required to be a const lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
-}
-
-template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any& __v) {
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType&>::value,
- "ValueType is required to be an lvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(*__tmp);
-}
-
-template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType any_cast(any&& __v) {
- using _RawValueType = __remove_cvref_t<_ValueType>;
- static_assert(is_constructible<_ValueType, _RawValueType>::value,
- "ValueType is required to be an rvalue reference "
- "or a CopyConstructible type");
- auto __tmp = std::any_cast<_RawValueType>(&__v);
- if (__tmp == nullptr)
- __throw_bad_any_cast();
- return static_cast<_ValueType>(std::move(*__tmp));
-}
-
-template <class _ValueType>
-inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
- static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
- static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
- return std::any_cast<_ValueType>(const_cast<any*>(__any));
-}
-
-template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void* __p, /*IsFunction*/ false_type) noexcept {
- return static_cast<_RetType>(__p);
-}
-
-template <class _RetType>
-inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction*/ true_type) noexcept {
- return nullptr;
-}
-
-template <class _ValueType>
-_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
- using __any_imp::_Action;
- static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
- static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
- typedef add_pointer_t<_ValueType> _ReturnType;
- if (__any && __any->__h_) {
- void* __p = __any->__call(
- _Action::_Get,
- nullptr,
-# if !defined(_LIBCPP_HAS_NO_RTTI)
- &typeid(_ValueType),
-# else
- nullptr,
-# endif
- __any_imp::__get_fallback_typeid<_ValueType>());
- return std::__pointer_or_func_cast<_ReturnType>(__p, is_function<_ValueType>{});
- }
- return nullptr;
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/chrono>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-# include <__cxx03/concepts>
-# include <__cxx03/cstdlib>
-# include <__cxx03/iosfwd>
-# include <__cxx03/iterator>
-# include <__cxx03/memory>
-# include <__cxx03/stdexcept>
-# include <__cxx03/type_traits>
-# include <__cxx03/variant>
-#endif
-
-#endif // _LIBCPP___CXX03_ANY
diff --git a/libcxx/include/__cxx03/array b/libcxx/include/__cxx03/array
index 74dc287aa54d6..a10e65420fce0 100644
--- a/libcxx/include/__cxx03/array
+++ b/libcxx/include/__cxx03/array
@@ -114,7 +114,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <__cxx03/__algorithm/equal.h>
#include <__cxx03/__algorithm/fill_n.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__algorithm/swap_ranges.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
@@ -143,14 +142,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [array.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
// [tuple.helper]
#include <__cxx03/__tuple/tuple_element.h>
@@ -504,7 +495,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iterator>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/atomic b/libcxx/include/__cxx03/atomic
index 1b488d99f80fb..20ecdfb91d9fa 100644
--- a/libcxx/include/__cxx03/atomic
+++ b/libcxx/include/__cxx03/atomic
@@ -609,10 +609,6 @@ template <class T>
#include <__cxx03/__atomic/memory_order.h>
#include <__cxx03/version>
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__atomic/atomic_ref.h>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -623,7 +619,6 @@ template <class T>
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/cmath>
-# include <__cxx03/compare>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/barrier b/libcxx/include/__cxx03/barrier
deleted file mode 100644
index 5e11f2439c402..0000000000000
--- a/libcxx/include/__cxx03/barrier
+++ /dev/null
@@ -1,308 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_BARRIER
-#define _LIBCPP___CXX03_BARRIER
-
-/*
- barrier synopsis
-
-namespace std
-{
-
- template<class CompletionFunction = see below>
- class barrier
- {
- public:
- using arrival_token = see below;
-
- static constexpr ptrdiff_t max() noexcept;
-
- constexpr explicit barrier(ptrdiff_t phase_count,
- CompletionFunction f = CompletionFunction());
- ~barrier();
-
- barrier(const barrier&) = delete;
- barrier& operator=(const barrier&) = delete;
-
- [[nodiscard]] arrival_token arrive(ptrdiff_t update = 1);
- void wait(arrival_token&& arrival) const;
-
- void arrive_and_wait();
- void arrive_and_drop();
-
- private:
- CompletionFunction completion; // exposition only
- };
-
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-
-# include <__cxx03/__assert>
-# include <__cxx03/__atomic/atomic_base.h>
-# include <__cxx03/__atomic/memory_order.h>
-# include <__cxx03/__memory/unique_ptr.h>
-# include <__cxx03/__thread/poll_with_backoff.h>
-# include <__cxx03/__thread/timed_backoff_policy.h>
-# include <__cxx03/__utility/move.h>
-# include <__cxx03/cstddef>
-# include <__cxx03/cstdint>
-# include <__cxx03/limits>
-# include <__cxx03/version>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-# if _LIBCPP_STD_VER >= 14
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-struct __empty_completion {
- inline _LIBCPP_HIDE_FROM_ABI void operator()() noexcept {}
-};
-
-# ifndef _LIBCPP_HAS_NO_TREE_BARRIER
-
-/*
-
-The default implementation of __barrier_base is a classic tree barrier.
-
-It looks different from literature pseudocode for two main reasons:
- 1. Threads that call into std::barrier functions do not provide indices,
- so a numbering step is added before the actual barrier algorithm,
- appearing as an N+1 round to the N rounds of the tree barrier.
- 2. A great deal of attention has been paid to avoid cache line thrashing
- by flattening the tree structure into cache-line sized arrays, that
- are indexed in an efficient way.
-
-*/
-
-using __barrier_phase_t = uint8_t;
-
-class __barrier_algorithm_base;
-
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
-__construct_barrier_algorithm_base(ptrdiff_t& __expected);
-
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
-__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept;
-
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
-__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept;
-
-template <class _CompletionF>
-class __barrier_base {
- ptrdiff_t __expected_;
- unique_ptr<__barrier_algorithm_base, void (*)(__barrier_algorithm_base*)> __base_;
- __atomic_base<ptrdiff_t> __expected_adjustment_;
- _CompletionF __completion_;
- __atomic_base<__barrier_phase_t> __phase_;
-
-public:
- using arrival_token = __barrier_phase_t;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI
- __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected_(__expected),
- __base_(std::__construct_barrier_algorithm_base(this->__expected_), &__destroy_barrier_algorithm_base),
- __expected_adjustment_(0),
- __completion_(std::move(__completion)),
- __phase_(0) {}
- _LIBCPP_NODISCARD _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __update <= __expected_, "update is greater than the expected count for the current barrier phase");
-
- auto const __old_phase = __phase_.load(memory_order_relaxed);
- for (; __update; --__update)
- if (__arrive_barrier_algorithm_base(__base_.get(), __old_phase)) {
- __completion_();
- __expected_ += __expected_adjustment_.load(memory_order_relaxed);
- __expected_adjustment_.store(0, memory_order_relaxed);
- __phase_.store(__old_phase + 2, memory_order_release);
- __phase_.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
- auto const __test_fn = [this, __old_phase]() -> bool { return __phase_.load(memory_order_acquire) != __old_phase; };
- std::__libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
- __expected_adjustment_.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
- }
-};
-
-# else
-
-/*
-
-The alternative implementation of __barrier_base is a central barrier.
-
-Two versions of this algorithm are provided:
- 1. A fairly straightforward implementation of the litterature for the
- general case where the completion function is not empty.
- 2. An optimized implementation that exploits 2's complement arithmetic
- and well-defined overflow in atomic arithmetic, to handle the phase
- roll-over for free.
-
-*/
-
-template <class _CompletionF>
-class __barrier_base {
- __atomic_base<ptrdiff_t> __expected;
- __atomic_base<ptrdiff_t> __arrived;
- _CompletionF __completion;
- __atomic_base<bool> __phase;
-
-public:
- using arrival_token = bool;
-
- static constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
-
- _LIBCPP_HIDE_FROM_ABI __barrier_base(ptrdiff_t __expected, _CompletionF __completion = _CompletionF())
- : __expected(__expected), __arrived(__expected), __completion(std::move(__completion)), __phase(false) {}
- [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
- auto const __old_phase = __phase.load(memory_order_relaxed);
- auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
- auto const new_expected = __expected.load(memory_order_relaxed);
-
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- update <= new_expected, "update is greater than the expected count for the current barrier phase");
-
- if (0 == __result) {
- __completion();
- __arrived.store(new_expected, memory_order_relaxed);
- __phase.store(!__old_phase, memory_order_release);
- __phase.notify_all();
- }
- return __old_phase;
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __old_phase) const {
- __phase.wait(__old_phase, memory_order_acquire);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
- __expected.fetch_sub(1, memory_order_relaxed);
- (void)arrive(1);
- }
-};
-
-template <>
-class __barrier_base<__empty_completion> {
- static constexpr uint64_t __expected_unit = 1ull;
- static constexpr uint64_t __arrived_unit = 1ull << 32;
- static constexpr uint64_t __expected_mask = __arrived_unit - 1;
- static constexpr uint64_t __phase_bit = 1ull << 63;
- static constexpr uint64_t __arrived_mask = (__phase_bit - 1) & ~__expected_mask;
-
- __atomic_base<uint64_t> __phase_arrived_expected;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr uint64_t __init(ptrdiff_t __count) _NOEXCEPT {
- return ((uint64_t(1u << 31) - __count) << 32) | (uint64_t(1u << 31) - __count);
- }
-
-public:
- using arrival_token = uint64_t;
-
- static constexpr ptrdiff_t max() noexcept { return ptrdiff_t(1u << 31) - 1; }
-
- _LIBCPP_HIDE_FROM_ABI explicit inline __barrier_base(ptrdiff_t __count, __empty_completion = __empty_completion())
- : __phase_arrived_expected(__init(__count)) {}
- [[nodiscard]] inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t update) {
- auto const __inc = __arrived_unit * update;
- auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
-
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- update <= __old, "update is greater than the expected count for the current barrier phase");
-
- if ((__old ^ (__old + __inc)) & __phase_bit) {
- __phase_arrived_expected.fetch_add((__old & __expected_mask) << 32, memory_order_relaxed);
- __phase_arrived_expected.notify_all();
- }
- return __old & __phase_bit;
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
- auto const __test_fn = [=]() -> bool {
- uint64_t const __current = __phase_arrived_expected.load(memory_order_acquire);
- return ((__current & __phase_bit) != __phase);
- };
- __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_timed_backoff_policy());
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() {
- __phase_arrived_expected.fetch_add(__expected_unit, memory_order_relaxed);
- (void)arrive(1);
- }
-};
-
-# endif // !_LIBCPP_HAS_NO_TREE_BARRIER
-
-template <class _CompletionF = __empty_completion>
-class _LIBCPP_DEPRECATED_ATOMIC_SYNC barrier {
- __barrier_base<_CompletionF> __b_;
-
-public:
- using arrival_token = typename __barrier_base<_CompletionF>::arrival_token;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); }
-
- _LIBCPP_AVAILABILITY_SYNC
- _LIBCPP_HIDE_FROM_ABI explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
- : __b_(__count, std::move(__completion)) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __count >= 0,
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __count <= max(),
- "barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
- "a value greater than max()");
- }
-
- barrier(barrier const&) = delete;
- barrier& operator=(barrier const&) = delete;
-
- _LIBCPP_NODISCARD _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update > 0, "barrier:arrive must be called with a value greater than 0");
- return __b_.arrive(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
- __b_.wait(std::move(__phase));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait() { wait(arrive()); }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_drop() { __b_.arrive_and_drop(); }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-# endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-# include <__cxx03/concepts>
-# include <__cxx03/iterator>
-# include <__cxx03/memory>
-# include <__cxx03/stdexcept>
-# include <__cxx03/variant>
-#endif
-
-#endif //_LIBCPP___CXX03_BARRIER
diff --git a/libcxx/include/__cxx03/bit b/libcxx/include/__cxx03/bit
deleted file mode 100644
index 29da3a21c8924..0000000000000
--- a/libcxx/include/__cxx03/bit
+++ /dev/null
@@ -1,101 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_BIT
-#define _LIBCPP___CXX03_BIT
-
-/*
- bit synopsis
-
-namespace std {
- // [bit.cast], bit_cast
- template<class To, class From>
- constexpr To bit_cast(const From& from) noexcept; // C++20
-
- // [bit.byteswap], byteswap
- template<class T>
- constexpr T byteswap(T value) noexcept; // C++23
-
- // [bit.pow.two], integral powers of 2
- template <class T>
- constexpr bool has_single_bit(T x) noexcept; // C++20
- template <class T>
- constexpr T bit_ceil(T x); // C++20
- template <class T>
- constexpr T bit_floor(T x) noexcept; // C++20
- template <class T>
- constexpr int bit_width(T x) noexcept; // C++20
-
- // [bit.rotate], rotating
- template<class T>
- constexpr T rotl(T x, int s) noexcept; // C++20
- template<class T>
- constexpr T rotr(T x, int s) noexcept; // C++20
-
- // [bit.count], counting
- template<class T>
- constexpr int countl_zero(T x) noexcept; // C++20
- template<class T>
- constexpr int countl_one(T x) noexcept; // C++20
- template<class T>
- constexpr int countr_zero(T x) noexcept; // C++20
- template<class T>
- constexpr int countr_one(T x) noexcept; // C++20
- template<class T>
- constexpr int popcount(T x) noexcept; // C++20
-
- // [bit.endian], endian
- enum class endian {
- little = see below, // C++20
- big = see below, // C++20
- native = see below // C++20
- };
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__bit/bit_cast.h>
-# include <__cxx03/__bit/bit_ceil.h>
-# include <__cxx03/__bit/bit_floor.h>
-# include <__cxx03/__bit/bit_log2.h>
-# include <__cxx03/__bit/bit_width.h>
-# include <__cxx03/__bit/countl.h>
-# include <__cxx03/__bit/countr.h>
-# include <__cxx03/__bit/endian.h>
-# include <__cxx03/__bit/has_single_bit.h>
-# include <__cxx03/__bit/popcount.h>
-# include <__cxx03/__bit/rotate.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__bit/byteswap.h>
-#endif
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/cstdint>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cstdlib>
-# include <__cxx03/iosfwd>
-# include <__cxx03/limits>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_BIT
diff --git a/libcxx/include/__cxx03/bitset b/libcxx/include/__cxx03/bitset
index 1507d0cdaf2f0..edd7782151ac2 100644
--- a/libcxx/include/__cxx03/bitset
+++ b/libcxx/include/__cxx03/bitset
@@ -961,7 +961,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/charconv b/libcxx/include/__cxx03/charconv
deleted file mode 100644
index 352189aa34087..0000000000000
--- a/libcxx/include/__cxx03/charconv
+++ /dev/null
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_CHARCONV
-#define _LIBCPP___CXX03_CHARCONV
-
-/*
- charconv synopsis
-
-namespace std {
-
- // floating-point format for primitive numerical conversion
- enum class chars_format {
- scientific = unspecified,
- fixed = unspecified,
- hex = unspecified,
- general = fixed | scientific
- };
-
- // 23.20.2, primitive numerical output conversion
- struct to_chars_result {
- char* ptr;
- errc ec;
- friend bool operator==(const to_chars_result&, const to_chars_result&) = default; // since C++20
- constexpr explicit operator bool() const noexcept { return ec == errc{}; } // since C++26
- };
-
- constexpr to_chars_result to_chars(char* first, char* last, see below value,
- int base = 10); // constexpr since C++23
- to_chars_result to_chars(char* first, char* last, bool value,
- int base = 10) = delete;
-
- to_chars_result to_chars(char* first, char* last, float value);
- to_chars_result to_chars(char* first, char* last, double value);
- to_chars_result to_chars(char* first, char* last, long double value);
-
- to_chars_result to_chars(char* first, char* last, float value,
- chars_format fmt);
- to_chars_result to_chars(char* first, char* last, double value,
- chars_format fmt);
- to_chars_result to_chars(char* first, char* last, long double value,
- chars_format fmt);
-
- to_chars_result to_chars(char* first, char* last, float value,
- chars_format fmt, int precision);
- to_chars_result to_chars(char* first, char* last, double value,
- chars_format fmt, int precision);
- to_chars_result to_chars(char* first, char* last, long double value,
- chars_format fmt, int precision);
-
- // 23.20.3, primitive numerical input conversion
- struct from_chars_result {
- const char* ptr;
- errc ec;
- friend bool operator==(const from_chars_result&, const from_chars_result&) = default; // since C++20
- constexpr explicit operator bool() const noexcept { return ec == errc{}; } // since C++26
- };
-
- constexpr from_chars_result from_chars(const char* first, const char* last,
- see below& value, int base = 10); // constexpr since C++23
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__charconv/chars_format.h>
-# include <__cxx03/__charconv/from_chars_integral.h>
-# include <__cxx03/__charconv/from_chars_result.h>
-# include <__cxx03/__charconv/tables.h>
-# include <__cxx03/__charconv/to_chars.h>
-# include <__cxx03/__charconv/to_chars_base_10.h>
-# include <__cxx03/__charconv/to_chars_floating_point.h>
-# include <__cxx03/__charconv/to_chars_integral.h>
-# include <__cxx03/__charconv/to_chars_result.h>
-# include <__cxx03/__charconv/traits.h>
-#endif // _LIBCPP_STD_VER >= 17
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-_LIBCPP_END_NAMESPACE_STD
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
-# include <__cxx03/cerrno>
-# include <__cxx03/cstddef>
-# include <__cxx03/initializer_list>
-# include <__cxx03/new>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cmath>
-# include <__cxx03/concepts>
-# include <__cxx03/cstdint>
-# include <__cxx03/cstdlib>
-# include <__cxx03/cstring>
-# include <__cxx03/iosfwd>
-# include <__cxx03/limits>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_CHARCONV
diff --git a/libcxx/include/__cxx03/chrono b/libcxx/include/__cxx03/chrono
index 167e85203ced6..6eb0a572a0772 100644
--- a/libcxx/include/__cxx03/chrono
+++ b/libcxx/include/__cxx03/chrono
@@ -948,49 +948,8 @@ constexpr chrono::year operator ""y(unsigned lo
#include <__cxx03/__chrono/system_clock.h>
#include <__cxx03/__chrono/time_point.h>
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__chrono/calendar.h>
-# include <__cxx03/__chrono/day.h>
-# include <__cxx03/__chrono/exception.h>
-# include <__cxx03/__chrono/hh_mm_ss.h>
-# include <__cxx03/__chrono/literals.h>
-# include <__cxx03/__chrono/local_info.h>
-# include <__cxx03/__chrono/month.h>
-# include <__cxx03/__chrono/month_weekday.h>
-# include <__cxx03/__chrono/monthday.h>
-# include <__cxx03/__chrono/sys_info.h>
-# include <__cxx03/__chrono/weekday.h>
-# include <__cxx03/__chrono/year.h>
-# include <__cxx03/__chrono/year_month.h>
-# include <__cxx03/__chrono/year_month_day.h>
-# include <__cxx03/__chrono/year_month_weekday.h>
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <__cxx03/__chrono/formatter.h>
-# include <__cxx03/__chrono/ostream.h>
-# include <__cxx03/__chrono/parser_std_format_spec.h>
-# include <__cxx03/__chrono/statically_widen.h>
-# endif
-
-# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
- !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <__cxx03/__chrono/leap_second.h>
-# include <__cxx03/__chrono/time_zone.h>
-# include <__cxx03/__chrono/time_zone_link.h>
-# include <__cxx03/__chrono/tzdb.h>
-# include <__cxx03/__chrono/tzdb_list.h>
-# include <__cxx03/__chrono/zoned_time.h>
-# endif
-
-#endif
-
#include <__cxx03/version>
-// standard-mandated includes
-
-// [time.syn]
-#include <__cxx03/compare>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -1003,12 +962,9 @@ constexpr chrono::year operator ""y(unsigned lo
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/bit>
-# include <__cxx03/concepts>
# include <__cxx03/cstring>
# include <__cxx03/forward_list>
# include <__cxx03/string>
-# include <__cxx03/tuple>
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20
diff --git a/libcxx/include/__cxx03/cmath b/libcxx/include/__cxx03/cmath
index 6aa9ad9c7c4d5..f545c62494235 100644
--- a/libcxx/include/__cxx03/cmath
+++ b/libcxx/include/__cxx03/cmath
@@ -324,7 +324,6 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
#include <__cxx03/limits>
#include <__cxx03/version>
-#include <__cxx03/__math/special_functions.h>
#include <__cxx03/math.h>
#ifndef _LIBCPP___CXX03_MATH_H
diff --git a/libcxx/include/__cxx03/codecvt b/libcxx/include/__cxx03/codecvt
index 22a4de3790d18..78c3540108086 100644
--- a/libcxx/include/__cxx03/codecvt
+++ b/libcxx/include/__cxx03/codecvt
@@ -580,11 +580,9 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstddef>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
-# include <__cxx03/initializer_list>
# include <__cxx03/iosfwd>
# include <__cxx03/limits>
# include <__cxx03/mutex>
diff --git a/libcxx/include/__cxx03/compare b/libcxx/include/__cxx03/compare
deleted file mode 100644
index 1199cc45c622b..0000000000000
--- a/libcxx/include/__cxx03/compare
+++ /dev/null
@@ -1,178 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_COMPARE
-#define _LIBCPP___CXX03_COMPARE
-
-/*
- compare synopsis
-
-namespace std {
- // [cmp.categories], comparison category types
- class partial_ordering;
- class weak_ordering;
- class strong_ordering;
-
- // named comparison functions
- constexpr bool is_eq (partial_ordering cmp) noexcept { return cmp == 0; }
- constexpr bool is_neq (partial_ordering cmp) noexcept { return cmp != 0; }
- constexpr bool is_lt (partial_ordering cmp) noexcept { return cmp < 0; }
- constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; }
- constexpr bool is_gt (partial_ordering cmp) noexcept { return cmp > 0; }
- constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; }
-
- // [cmp.common], common comparison category type
- template<class... Ts>
- struct common_comparison_category {
- using type = see below;
- };
- template<class... Ts>
- using common_comparison_category_t = typename common_comparison_category<Ts...>::type;
-
- // [cmp.concept], concept three_way_comparable
- template<class T, class Cat = partial_ordering>
- concept three_way_comparable = see below;
- template<class T, class U, class Cat = partial_ordering>
- concept three_way_comparable_with = see below;
-
- // [cmp.result], result of three-way comparison
- template<class T, class U = T> struct compare_three_way_result;
-
- template<class T, class U = T>
- using compare_three_way_result_t = typename compare_three_way_result<T, U>::type;
-
- // [comparisons.three.way], class compare_three_way
- struct compare_three_way; // C++20
-
- // [cmp.alg], comparison algorithms
- inline namespace unspecified {
- inline constexpr unspecified strong_order = unspecified;
- inline constexpr unspecified weak_order = unspecified;
- inline constexpr unspecified partial_order = unspecified;
- inline constexpr unspecified compare_strong_order_fallback = unspecified;
- inline constexpr unspecified compare_weak_order_fallback = unspecified;
- inline constexpr unspecified compare_partial_order_fallback = unspecified;
- }
-
- // [cmp.partialord], Class partial_ordering
- class partial_ordering {
- public:
- // valid values
- static const partial_ordering less;
- static const partial_ordering equivalent;
- static const partial_ordering greater;
- static const partial_ordering unordered;
-
- // comparisons
- friend constexpr bool operator==(partial_ordering v, unspecified) noexcept;
- friend constexpr bool operator==(partial_ordering v, partial_ordering w) noexcept = default;
- friend constexpr bool operator< (partial_ordering v, unspecified) noexcept;
- friend constexpr bool operator> (partial_ordering v, unspecified) noexcept;
- friend constexpr bool operator<=(partial_ordering v, unspecified) noexcept;
- friend constexpr bool operator>=(partial_ordering v, unspecified) noexcept;
- friend constexpr bool operator< (unspecified, partial_ordering v) noexcept;
- friend constexpr bool operator> (unspecified, partial_ordering v) noexcept;
- friend constexpr bool operator<=(unspecified, partial_ordering v) noexcept;
- friend constexpr bool operator>=(unspecified, partial_ordering v) noexcept;
- friend constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;
- friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;
- };
-
- // [cmp.weakord], Class weak_ordering
- class weak_ordering {
- public:
- // valid values
- static const weak_ordering less;
- static const weak_ordering equivalent;
- static const weak_ordering greater;
-
- // conversions
- constexpr operator partial_ordering() const noexcept;
-
- // comparisons
- friend constexpr bool operator==(weak_ordering v, unspecified) noexcept;
- friend constexpr bool operator==(weak_ordering v, weak_ordering w) noexcept = default;
- friend constexpr bool operator< (weak_ordering v, unspecified) noexcept;
- friend constexpr bool operator> (weak_ordering v, unspecified) noexcept;
- friend constexpr bool operator<=(weak_ordering v, unspecified) noexcept;
- friend constexpr bool operator>=(weak_ordering v, unspecified) noexcept;
- friend constexpr bool operator< (unspecified, weak_ordering v) noexcept;
- friend constexpr bool operator> (unspecified, weak_ordering v) noexcept;
- friend constexpr bool operator<=(unspecified, weak_ordering v) noexcept;
- friend constexpr bool operator>=(unspecified, weak_ordering v) noexcept;
- friend constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;
- friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;
- };
-
- // [cmp.strongord], Class strong_ordering
- class strong_ordering {
- public:
- // valid values
- static const strong_ordering less;
- static const strong_ordering equal;
- static const strong_ordering equivalent;
- static const strong_ordering greater;
-
- // conversions
- constexpr operator partial_ordering() const noexcept;
- constexpr operator weak_ordering() const noexcept;
-
- // comparisons
- friend constexpr bool operator==(strong_ordering v, unspecified) noexcept;
- friend constexpr bool operator==(strong_ordering v, strong_ordering w) noexcept = default;
- friend constexpr bool operator< (strong_ordering v, unspecified) noexcept;
- friend constexpr bool operator> (strong_ordering v, unspecified) noexcept;
- friend constexpr bool operator<=(strong_ordering v, unspecified) noexcept;
- friend constexpr bool operator>=(strong_ordering v, unspecified) noexcept;
- friend constexpr bool operator< (unspecified, strong_ordering v) noexcept;
- friend constexpr bool operator> (unspecified, strong_ordering v) noexcept;
- friend constexpr bool operator<=(unspecified, strong_ordering v) noexcept;
- friend constexpr bool operator>=(unspecified, strong_ordering v) noexcept;
- friend constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept;
- friend constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept;
- };
-}
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__compare/common_comparison_category.h>
-# include <__cxx03/__compare/compare_partial_order_fallback.h>
-# include <__cxx03/__compare/compare_strong_order_fallback.h>
-# include <__cxx03/__compare/compare_three_way.h>
-# include <__cxx03/__compare/compare_three_way_result.h>
-# include <__cxx03/__compare/compare_weak_order_fallback.h>
-# include <__cxx03/__compare/is_eq.h>
-# include <__cxx03/__compare/ordering.h>
-# include <__cxx03/__compare/partial_order.h>
-# include <__cxx03/__compare/strong_order.h>
-# include <__cxx03/__compare/synth_three_way.h>
-# include <__cxx03/__compare/three_way_comparable.h>
-# include <__cxx03/__compare/weak_order.h>
-#endif // _LIBCPP_STD_VER >= 20
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/cstddef>
-# include <__cxx03/cstdint>
-# include <__cxx03/limits>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cmath>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_COMPARE
diff --git a/libcxx/include/__cxx03/concepts b/libcxx/include/__cxx03/concepts
deleted file mode 100644
index 4e129022e55a0..0000000000000
--- a/libcxx/include/__cxx03/concepts
+++ /dev/null
@@ -1,173 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_CONCEPTS
-#define _LIBCPP___CXX03_CONCEPTS
-
-/*
- concepts synopsis
-namespace std {
- // [concepts.lang], language-related concepts
- // [concept.same], concept same_as
- template<class T, class U>
- concept same_as = see below;
-
- // [concept.derived], concept derived_from
- template<class Derived, class Base>
- concept derived_from = see below;
-
- // [concept.convertible], concept convertible_to
- template<class From, class To>
- concept convertible_to = see below;
-
- // [concept.commonref], concept common_reference_with
- template<class T, class U>
- concept common_reference_with = see below;
-
- // [concept.common], concept common_with
- template<class T, class U>
- concept common_with = see below;
-
- // [concepts.arithmetic], arithmetic concepts
- template<class T>
- concept integral = see below;
- template<class T>
- concept signed_integral = see below;
- template<class T>
- concept unsigned_integral = see below;
- template<class T>
- concept floating_point = see below;
-
- // [concept.assignable], concept assignable_from
- template<class LHS, class RHS>
- concept assignable_from = see below;
-
- // [concept.swappable], concept swappable
- namespace ranges {
- inline namespace unspecified {
- inline constexpr unspecified swap = unspecified;
- }
- }
- template<class T>
- concept swappable = see below;
- template<class T, class U>
- concept swappable_with = see below;
-
- // [concept.destructible], concept destructible
- template<class T>
- concept destructible = see below;
-
- // [concept.constructible], concept constructible_from
- template<class T, class... Args>
- concept constructible_from = see below;
-
- // [concept.default.init], concept default_initializable
- template<class T>
- concept default_initializable = see below;
-
- // [concept.moveconstructible], concept move_constructible
- template<class T>
- concept move_constructible = see below;
-
- // [concept.copyconstructible], concept copy_constructible
- template<class T>
- concept copy_constructible = see below;
-
- // [concept.equalitycomparable], concept equality_comparable
- template<class T>
- concept equality_comparable = see below;
- template<class T, class U>
- concept equality_comparable_with = see below;
-
- // [concept.totallyordered], concept totally_ordered
- template<class T>
- concept totally_ordered = see below;
- template<class T, class U>
- concept totally_ordered_with = see below;
-
- // [concepts.object], object concepts
- template<class T>
- concept movable = see below;
- template<class T>
- concept copyable = see below;
- template<class T>
- concept semiregular = see below;
- template<class T>
- concept regular = see below;
-
- // [concepts.callable], callable concepts
- // [concept.invocable], concept invocable
- template<class F, class... Args>
- concept invocable = see below;
-
- // [concept.regularinvocable], concept regular_invocable
- template<class F, class... Args>
- concept regular_invocable = see below;
-
- // [concept.predicate], concept predicate
- template<class F, class... Args>
- concept predicate = see below;
-
- // [concept.relation], concept relation
- template<class R, class T, class U>
- concept relation = see below;
-
- // [concept.equiv], concept equivalence_relation
- template<class R, class T, class U>
- concept equivalence_relation = see below;
-
- // [concept.strictweakorder], concept strict_weak_order
- template<class R, class T, class U>
- concept strict_weak_order = see below;
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__concepts/arithmetic.h>
-# include <__cxx03/__concepts/assignable.h>
-# include <__cxx03/__concepts/boolean_testable.h>
-# include <__cxx03/__concepts/class_or_enum.h>
-# include <__cxx03/__concepts/common_reference_with.h>
-# include <__cxx03/__concepts/common_with.h>
-# include <__cxx03/__concepts/constructible.h>
-# include <__cxx03/__concepts/convertible_to.h>
-# include <__cxx03/__concepts/copyable.h>
-# include <__cxx03/__concepts/derived_from.h>
-# include <__cxx03/__concepts/destructible.h>
-# include <__cxx03/__concepts/different_from.h>
-# include <__cxx03/__concepts/equality_comparable.h>
-# include <__cxx03/__concepts/invocable.h>
-# include <__cxx03/__concepts/movable.h>
-# include <__cxx03/__concepts/predicate.h>
-# include <__cxx03/__concepts/regular.h>
-# include <__cxx03/__concepts/relation.h>
-# include <__cxx03/__concepts/same_as.h>
-# include <__cxx03/__concepts/semiregular.h>
-# include <__cxx03/__concepts/swappable.h>
-# include <__cxx03/__concepts/totally_ordered.h>
-#endif // _LIBCPP_STD_VER >= 20
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/cstddef>
-#endif
-
-#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
-# include <__cxx03/type_traits>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#endif // _LIBCPP___CXX03_CONCEPTS
diff --git a/libcxx/include/__cxx03/condition_variable b/libcxx/include/__cxx03/condition_variable
index 5ad540c4626c0..9a803787c101f 100644
--- a/libcxx/include/__cxx03/condition_variable
+++ b/libcxx/include/__cxx03/condition_variable
@@ -128,8 +128,6 @@ public:
#include <__cxx03/__mutex/mutex.h>
#include <__cxx03/__mutex/tag_types.h>
#include <__cxx03/__mutex/unique_lock.h>
-#include <__cxx03/__stop_token/stop_callback.h>
-#include <__cxx03/__stop_token/stop_token.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/version>
@@ -353,11 +351,9 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdint>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
-# include <__cxx03/initializer_list>
# include <__cxx03/iosfwd>
# include <__cxx03/new>
# include <__cxx03/stdexcept>
diff --git a/libcxx/include/__cxx03/coroutine b/libcxx/include/__cxx03/coroutine
deleted file mode 100644
index 6f2af35cc4d76..0000000000000
--- a/libcxx/include/__cxx03/coroutine
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_COROUTINE
-#define _LIBCPP___CXX03_COROUTINE
-
-/**
- coroutine synopsis
-
-namespace std {
-// [coroutine.traits]
-template <class R, class... ArgTypes>
- struct coroutine_traits;
-// [coroutine.handle]
-template <class Promise = void>
- struct coroutine_handle;
-// [coroutine.handle.compare]
-constexpr bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-constexpr strong_ordering operator<=>(coroutine_handle<> x, coroutine_handle<> y) noexcept;
-// [coroutine.handle.hash]
-template <class T> struct hash;
-template <class P> struct hash<coroutine_handle<P>>;
-// [coroutine.noop]
-struct noop_coroutine_promise;
-template<> struct coroutine_handle<noop_coroutine_promise>;
-using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
-noop_coroutine_handle noop_coroutine() noexcept;
-// [coroutine.trivial.awaitables]
-struct suspend_never;
-struct suspend_always;
-} // namespace std
-
- */
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__coroutine/coroutine_handle.h>
-# include <__cxx03/__coroutine/coroutine_traits.h>
-# include <__cxx03/__coroutine/noop_coroutine_handle.h>
-# include <__cxx03/__coroutine/trivial_awaitables.h>
-#endif // _LIBCPP_STD_VER >= 20
-
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [coroutine.syn]
-#include <__cxx03/compare>
-
-#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/iosfwd>
-# include <__cxx03/limits>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_COROUTINE
diff --git a/libcxx/include/__cxx03/deque b/libcxx/include/__cxx03/deque
index 8e40befbb71ea..98c3e5c386bef 100644
--- a/libcxx/include/__cxx03/deque
+++ b/libcxx/include/__cxx03/deque
@@ -183,7 +183,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__algorithm/equal.h>
#include <__cxx03/__algorithm/fill_n.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__algorithm/min.h>
#include <__cxx03/__algorithm/remove.h>
#include <__cxx03/__algorithm/remove_if.h>
@@ -191,7 +190,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__debug_utils/sanitizers.h>
-#include <__cxx03/__format/enable_insertable.h>
#include <__cxx03/__fwd/deque.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
@@ -204,12 +202,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__memory/pointer_traits.h>
#include <__cxx03/__memory/temp_value.h>
#include <__cxx03/__memory/unique_ptr.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/size.h>
#include <__cxx03/__split_buffer>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__type_traits/is_convertible.h>
@@ -228,14 +220,6 @@ template <class T, class Allocator, class Predicate>
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [deque.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -2609,7 +2593,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
# include <__cxx03/iosfwd>
diff --git a/libcxx/include/__cxx03/execution b/libcxx/include/__cxx03/execution
deleted file mode 100644
index b056c9c226e18..0000000000000
--- a/libcxx/include/__cxx03/execution
+++ /dev/null
@@ -1,149 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXECUTION
-#define _LIBCPP___CXX03_EXECUTION
-
-/*
-namespace std::execution {
- struct sequenced_policy;
- struct parallel_policy;
- struct parallel_unsequenced_policy;
- struct unsequenced_policy; // since C++20
-
- inline constexpr sequenced_policy seq = implementation-defined;
- inline constexpr parallel_policy par = implementation-defined;
- inline constexpr parallel_unsequenced_policy par_unseq = implementation-defined;
- inline constexpr unsequenced_policy unseq = implementation-defined; // since C++20
-}
-
-namespace std {
- template <class T>
- struct is_execution_policy;
-
- template <class T>
- inline constexpr bool is_execution_policy_v;
-}
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/__type_traits/is_execution_policy.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace execution {
-struct sequenced_policy {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit sequenced_policy(__disable_user_instantiations_tag) {}
- sequenced_policy(const sequenced_policy&) = delete;
- sequenced_policy& operator=(const sequenced_policy&) = delete;
-};
-
-inline constexpr sequenced_policy seq{__disable_user_instantiations_tag{}};
-
-struct parallel_policy {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_policy(__disable_user_instantiations_tag) {}
- parallel_policy(const parallel_policy&) = delete;
- parallel_policy& operator=(const parallel_policy&) = delete;
-};
-
-inline constexpr parallel_policy par{__disable_user_instantiations_tag{}};
-
-struct parallel_unsequenced_policy {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_unsequenced_policy(__disable_user_instantiations_tag) {}
- parallel_unsequenced_policy(const parallel_unsequenced_policy&) = delete;
- parallel_unsequenced_policy& operator=(const parallel_unsequenced_policy&) = delete;
-};
-
-inline constexpr parallel_unsequenced_policy par_unseq{__disable_user_instantiations_tag{}};
-
-struct __unsequenced_policy {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __unsequenced_policy(__disable_user_instantiations_tag) {}
- __unsequenced_policy(const __unsequenced_policy&) = delete;
- __unsequenced_policy& operator=(const __unsequenced_policy&) = delete;
-};
-
-constexpr __unsequenced_policy __unseq{__disable_user_instantiations_tag{}};
-
-# if _LIBCPP_STD_VER >= 20
-
-struct unsequenced_policy {
- _LIBCPP_HIDE_FROM_ABI constexpr explicit unsequenced_policy(__disable_user_instantiations_tag) {}
- unsequenced_policy(const unsequenced_policy&) = delete;
- unsequenced_policy& operator=(const unsequenced_policy&) = delete;
-};
-
-inline constexpr unsequenced_policy unseq{__disable_user_instantiations_tag{}};
-
-# endif // _LIBCPP_STD_VER >= 20
-
-} // namespace execution
-
-template <>
-inline constexpr bool is_execution_policy_v<execution::sequenced_policy> = true;
-
-template <>
-inline constexpr bool is_execution_policy_v<execution::parallel_policy> = true;
-
-template <>
-inline constexpr bool is_execution_policy_v<execution::parallel_unsequenced_policy> = true;
-
-template <>
-inline constexpr bool is_execution_policy_v<execution::__unsequenced_policy> = true;
-
-template <>
-inline constexpr bool __is_parallel_execution_policy_impl<execution::parallel_policy> = true;
-
-template <>
-inline constexpr bool __is_parallel_execution_policy_impl<execution::parallel_unsequenced_policy> = true;
-
-template <>
-inline constexpr bool __is_unsequenced_execution_policy_impl<execution::__unsequenced_policy> = true;
-
-template <>
-inline constexpr bool __is_unsequenced_execution_policy_impl<execution::parallel_unsequenced_policy> = true;
-
-# if _LIBCPP_STD_VER >= 20
-template <>
-inline constexpr bool is_execution_policy_v<execution::unsequenced_policy> = true;
-
-template <>
-inline constexpr bool __is_unsequenced_execution_policy_impl<execution::unsequenced_policy> = true;
-
-# endif
-
-template <class _Tp>
-struct is_execution_policy : bool_constant<is_execution_policy_v<_Tp>> {};
-
-template <class _ExecutionPolicy>
-_LIBCPP_HIDE_FROM_ABI auto __remove_parallel_policy(const _ExecutionPolicy&) {
- if constexpr (is_same_v<_ExecutionPolicy, execution::parallel_policy>) {
- return execution::sequenced_policy(execution::__disable_user_instantiations_tag{});
- } else if constexpr (is_same_v<_ExecutionPolicy, execution::parallel_unsequenced_policy>) {
- return execution::__unsequenced_policy{execution::__disable_user_instantiations_tag{}};
- }
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cstddef>
-#endif
-
-#endif // _LIBCPP___CXX03_EXECUTION
diff --git a/libcxx/include/__cxx03/expected b/libcxx/include/__cxx03/expected
deleted file mode 100644
index 6c5ebf190a898..0000000000000
--- a/libcxx/include/__cxx03/expected
+++ /dev/null
@@ -1,62 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPECTED
-#define _LIBCPP___CXX03_EXPECTED
-
-/*
- Header <expected> synopsis
-
-namespace std {
- // [expected.unexpected], class template unexpected
- template<class E> class unexpected;
-
- // [expected.bad], class template bad_expected_access
- template<class E> class bad_expected_access;
-
- // [expected.bad.void], specialization for void
- template<> class bad_expected_access<void>;
-
- // in-place construction of unexpected values
- struct unexpect_t {
- explicit unexpect_t() = default;
- };
- inline constexpr unexpect_t unexpect{};
-
- // [expected.expected], class template expected
- template<class T, class E> class expected;
-
- // [expected.void], partial specialization of expected for void types
- template<class T, class E> requires is_void_v<T> class expected<T, E>;
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__expected/bad_expected_access.h>
-# include <__cxx03/__expected/expected.h>
-# include <__cxx03/__expected/unexpect.h>
-# include <__cxx03/__expected/unexpected.h>
-#endif
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cstddef>
-# include <__cxx03/initializer_list>
-# include <__cxx03/new>
-#endif
-
-#endif // _LIBCPP___CXX03_EXPECTED
diff --git a/libcxx/include/__cxx03/experimental/__simd/aligned_tag.h b/libcxx/include/__cxx03/experimental/__simd/aligned_tag.h
deleted file mode 100644
index ea0ddd94e4687..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/aligned_tag.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
-
-#include <__cxx03/__memory/assume_aligned.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/traits.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-// memory alignment
-struct element_aligned_tag {
- template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = alignof(_Up);
-
- template <class _Tp, class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
- return __ptr;
- }
-};
-
-template <>
-inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
-
-struct vector_aligned_tag {
- template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = memory_alignment_v<_Tp, remove_const_t<_Up>>;
-
- template <class _Tp, class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
- return std::__assume_aligned<__alignment<_Tp, _Up>, _Up>(__ptr);
- }
-};
-
-template <>
-inline constexpr bool is_simd_flag_type_v<vector_aligned_tag> = true;
-
-template <size_t _Np>
-struct overaligned_tag {
- template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = _Np;
-
- template <class _Tp, class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
- return std::__assume_aligned<__alignment<_Tp, _Up>, _Up>(__ptr);
- }
-};
-
-template <size_t _Np>
-inline constexpr bool is_simd_flag_type_v<overaligned_tag<_Np>> = true;
-
-inline constexpr element_aligned_tag element_aligned{};
-
-inline constexpr vector_aligned_tag vector_aligned{};
-
-template <size_t _Np>
-inline constexpr overaligned_tag<_Np> overaligned{};
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/declaration.h b/libcxx/include/__cxx03/experimental/__simd/declaration.h
deleted file mode 100644
index 94f068ee8b2af..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/declaration.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_DECLARATION_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_DECLARATION_H
-
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-template <int>
-struct __vec_ext;
-struct __scalar;
-
-using scalar = __scalar;
-
-// TODO: make this platform dependent
-template <int _Np>
-using fixed_size = __vec_ext<_Np>;
-
-template <class _Tp>
-inline constexpr int max_fixed_size = 32;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using compatible = __vec_ext<16 / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp>
-using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>;
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-struct deduce {
- using type = fixed_size<_Np>;
-};
-
-// TODO: make this platform dependent
-template <class _Tp, size_t _Np, class... _Abis>
-using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type;
-
-} // namespace simd_abi
-
-template <class _Tp, class _Abi>
-struct __simd_storage;
-
-template <class _Tp, class _Abi>
-struct __mask_storage;
-
-template <class _Tp, class _Abi>
-struct __simd_operations;
-
-template <class _Tp, class _Abi>
-struct __mask_operations;
-
-struct element_aligned_tag;
-struct vector_aligned_tag;
-template <size_t>
-struct overaligned_tag;
-
-template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
-class simd;
-
-template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
-class simd_mask;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_DECLARATION_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/reference.h b/libcxx/include/__cxx03/experimental/__simd/reference.h
deleted file mode 100644
index b7330d4b175cb..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/reference.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_REFERENCE_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_REFERENCE_H
-
-#include <__cxx03/__type_traits/is_assignable.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/utility.h>
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-template <class _Tp, class _Storage, class _Vp>
-class __simd_reference {
- template <class, class>
- friend class simd;
- template <class, class>
- friend class simd_mask;
-
- _Storage& __s_;
- size_t __idx_;
-
- _LIBCPP_HIDE_FROM_ABI __simd_reference(_Storage& __s, size_t __idx) : __s_(__s), __idx_(__idx) {}
-
- _LIBCPP_HIDE_FROM_ABI _Vp __get() const noexcept { return __s_.__get(__idx_); }
-
- _LIBCPP_HIDE_FROM_ABI void __set(_Vp __v) {
- if constexpr (is_same_v<_Vp, bool>)
- __s_.__set(__idx_, experimental::__set_all_bits<_Tp>(__v));
- else
- __s_.__set(__idx_, __v);
- }
-
-public:
- using value_type = _Vp;
-
- __simd_reference() = delete;
- __simd_reference(const __simd_reference&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI operator value_type() const noexcept { return __get(); }
-
- template <class _Up, enable_if_t<is_assignable_v<value_type&, _Up&&>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI __simd_reference operator=(_Up&& __v) && noexcept {
- __set(static_cast<value_type>(std::forward<_Up>(__v)));
- return {__s_, __idx_};
- }
-
- // Note: This approach might not fully align with the specification,
- // which might be a wording defect. (https://wg21.link/N4808 section 9.6.3)
- template <class _Tp1, class _Storage1, class _Vp1>
- friend void
- swap(__simd_reference<_Tp1, _Storage1, _Vp1>&& __a, __simd_reference<_Tp1, _Storage1, _Vp1>&& __b) noexcept;
-
- template <class _Tp1, class _Storage1, class _Vp1>
- friend void swap(_Vp1& __a, __simd_reference<_Tp1, _Storage1, _Vp1>&& __b) noexcept;
-
- template <class _Tp1, class _Storage1, class _Vp1>
- friend void swap(__simd_reference<_Tp1, _Storage1, _Vp1>&& __a, _Vp1& __b) noexcept;
-};
-
-template <class _Tp, class _Storage, class _Vp>
-_LIBCPP_HIDE_FROM_ABI void
-swap(__simd_reference<_Tp, _Storage, _Vp>&& __a, __simd_reference<_Tp, _Storage, _Vp>&& __b) noexcept {
- _Vp __tmp(std::move(__a));
- std::move(__a) = std::move(__b);
- std::move(__b) = std::move(__tmp);
-}
-
-template <class _Tp, class _Storage, class _Vp>
-_LIBCPP_HIDE_FROM_ABI void swap(_Vp& __a, __simd_reference<_Tp, _Storage, _Vp>&& __b) noexcept {
- _Vp __tmp(std::move(__a));
- __a = std::move(__b);
- std::move(__b) = std::move(__tmp);
-}
-
-template <class _Tp, class _Storage, class _Vp>
-_LIBCPP_HIDE_FROM_ABI void swap(__simd_reference<_Tp, _Storage, _Vp>&& __a, _Vp& __b) noexcept {
- _Vp __tmp(std::move(__a));
- std::move(__a) = std::move(__b);
- __b = std::move(__tmp);
-}
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_REFERENCE_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/scalar.h b/libcxx/include/__cxx03/experimental/__simd/scalar.h
deleted file mode 100644
index 5f582c6dd8ea7..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/scalar.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_SCALAR_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SCALAR_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/traits.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-struct __scalar {
- static constexpr size_t __simd_size = 1;
-};
-} // namespace simd_abi
-
-template <>
-inline constexpr bool is_abi_tag_v<simd_abi::__scalar> = true;
-
-template <class _Tp>
-struct __simd_storage<_Tp, simd_abi::__scalar> {
- _Tp __data;
-
- _LIBCPP_HIDE_FROM_ABI _Tp __get([[maybe_unused]] size_t __idx) const noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx == 0, "Index is out of bounds");
- return __data;
- }
- _LIBCPP_HIDE_FROM_ABI void __set([[maybe_unused]] size_t __idx, _Tp __v) noexcept {
- _LIBCPP_ASSERT_UNCATEGORIZED(__idx == 0, "Index is out of bounds");
- __data = __v;
- }
-};
-
-template <class _Tp>
-struct __mask_storage<_Tp, simd_abi::__scalar> : __simd_storage<bool, simd_abi::__scalar> {};
-
-template <class _Tp>
-struct __simd_operations<_Tp, simd_abi::__scalar> {
- using _SimdStorage = __simd_storage<_Tp, simd_abi::__scalar>;
- using _MaskStorage = __mask_storage<_Tp, simd_abi::__scalar>;
-
- static _LIBCPP_HIDE_FROM_ABI _SimdStorage __broadcast(_Tp __v) noexcept { return {__v}; }
-
- template <class _Generator>
- static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept {
- return {__g(std::integral_constant<size_t, 0>())};
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept {
- __s.__data = static_cast<_Tp>(__mem[0]);
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI void __store(_SimdStorage __s, _Up* __mem) noexcept {
- *__mem = static_cast<_Up>(__s.__data);
- }
-};
-
-template <class _Tp>
-struct __mask_operations<_Tp, simd_abi::__scalar> {
- using _MaskStorage = __mask_storage<_Tp, simd_abi::__scalar>;
-
- static _LIBCPP_HIDE_FROM_ABI _MaskStorage __broadcast(bool __v) noexcept { return {__v}; }
-
- static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept { __s.__data = __mem[0]; }
-
- static _LIBCPP_HIDE_FROM_ABI void __store(_MaskStorage __s, bool* __mem) noexcept { __mem[0] = __s.__data; }
-};
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SCALAR_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/simd.h b/libcxx/include/__cxx03/experimental/__simd/simd.h
deleted file mode 100644
index 8f9d94d9ae535..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/simd.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_SIMD_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SIMD_H
-
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/reference.h>
-#include <__cxx03/experimental/__simd/traits.h>
-#include <__cxx03/experimental/__simd/utility.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-
-// class template simd [simd.class]
-// TODO: implement simd class
-template <class _Tp, class _Abi>
-class simd {
- using _Impl = __simd_operations<_Tp, _Abi>;
- using _Storage = typename _Impl::_SimdStorage;
-
- _Storage __s_;
-
-public:
- using value_type = _Tp;
- using reference = __simd_reference<_Tp, _Storage, value_type>;
- using mask_type = simd_mask<_Tp, _Abi>;
- using abi_type = _Abi;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return simd_size_v<value_type, abi_type>; }
-
- _LIBCPP_HIDE_FROM_ABI simd() noexcept = default;
-
- // broadcast constructor
- template <class _Up, enable_if_t<__can_broadcast_v<value_type, __remove_cvref_t<_Up>>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI simd(_Up&& __v) noexcept : __s_(_Impl::__broadcast(static_cast<value_type>(__v))) {}
-
- // implicit type conversion constructor
- template <class _Up,
- enable_if_t<!is_same_v<_Up, _Tp> && is_same_v<abi_type, simd_abi::fixed_size<size()>> &&
- __is_non_narrowing_convertible_v<_Up, value_type>,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI simd(const simd<_Up, simd_abi::fixed_size<size()>>& __v) noexcept {
- for (size_t __i = 0; __i < size(); __i++) {
- (*this)[__i] = static_cast<value_type>(__v[__i]);
- }
- }
-
- // generator constructor
- template <class _Generator, enable_if_t<__can_generate_v<value_type, _Generator, size()>, int> = 0>
- explicit _LIBCPP_HIDE_FROM_ABI simd(_Generator&& __g) noexcept
- : __s_(_Impl::__generate(std::forward<_Generator>(__g))) {}
-
- // load constructor
- template <class _Up, class _Flags, enable_if_t<__is_vectorizable_v<_Up> && is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI simd(const _Up* __mem, _Flags) {
- _Impl::__load(__s_, _Flags::template __apply<simd>(__mem));
- }
-
- // copy functions
- template <class _Up, class _Flags, enable_if_t<__is_vectorizable_v<_Up> && is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void copy_from(const _Up* __mem, _Flags) {
- _Impl::__load(__s_, _Flags::template __apply<simd>(__mem));
- }
-
- template <class _Up, class _Flags, enable_if_t<__is_vectorizable_v<_Up> && is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void copy_to(_Up* __mem, _Flags) const {
- _Impl::__store(__s_, _Flags::template __apply<simd>(__mem));
- }
-
- // scalar access [simd.subscr]
- _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); }
- _LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); }
-};
-
-template <class _Tp, class _Abi>
-inline constexpr bool is_simd_v<simd<_Tp, _Abi>> = true;
-
-template <class _Tp>
-using native_simd = simd<_Tp, simd_abi::native<_Tp>>;
-
-template <class _Tp, int _Np>
-using fixed_size_simd = simd<_Tp, simd_abi::fixed_size<_Np>>;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SIMD_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/simd_mask.h b/libcxx/include/__cxx03/experimental/__simd/simd_mask.h
deleted file mode 100644
index 34658d0e2eeae..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/simd_mask.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_SIMD_MASK_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SIMD_MASK_H
-
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/reference.h>
-#include <__cxx03/experimental/__simd/traits.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-
-// class template simd_mask [simd.mask.class]
-// TODO: implement simd_mask class
-template <class _Tp, class _Abi>
-class simd_mask {
- using _Impl = __mask_operations<_Tp, _Abi>;
- using _Storage = typename _Impl::_MaskStorage;
-
- _Storage __s_;
-
-public:
- using value_type = bool;
- using reference = __simd_reference<_Tp, _Storage, value_type>;
- using simd_type = simd<_Tp, _Abi>;
- using abi_type = _Abi;
-
- static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return simd_type::size(); }
-
- _LIBCPP_HIDE_FROM_ABI simd_mask() noexcept = default;
-
- // broadcast constructor
- _LIBCPP_HIDE_FROM_ABI explicit simd_mask(value_type __v) noexcept : __s_(_Impl::__broadcast(__v)) {}
-
- // implicit type conversion constructor
- template <class _Up, enable_if_t<!is_same_v<_Up, _Tp> && is_same_v<abi_type, simd_abi::fixed_size<size()>>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI simd_mask(const simd_mask<_Up, simd_abi::fixed_size<size()>>& __v) noexcept {
- for (size_t __i = 0; __i < size(); __i++) {
- (*this)[__i] = __v[__i];
- }
- }
-
- // load constructor
- template <class _Flags, enable_if_t<is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI simd_mask(const value_type* __mem, _Flags) {
- _Impl::__load(__s_, _Flags::template __apply<simd_mask>(__mem));
- }
-
- // copy functions
- template <class _Flags, enable_if_t<is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void copy_from(const value_type* __mem, _Flags) {
- _Impl::__load(__s_, _Flags::template __apply<simd_mask>(__mem));
- }
-
- template <class _Flags, enable_if_t<is_simd_flag_type_v<_Flags>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void copy_to(value_type* __mem, _Flags) const {
- _Impl::__store(__s_, _Flags::template __apply<simd_mask>(__mem));
- }
-
- // scalar access [simd.mask.subscr]
- _LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); }
- _LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); }
-};
-
-template <class _Tp, class _Abi>
-inline constexpr bool is_simd_mask_v<simd_mask<_Tp, _Abi>> = true;
-
-template <class _Tp>
-using native_simd_mask = simd_mask<_Tp, simd_abi::native<_Tp>>;
-
-template <class _Tp, int _Np>
-using fixed_size_simd_mask = simd_mask<_Tp, simd_abi::fixed_size<_Np>>;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_SIMD_MASK_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/traits.h b/libcxx/include/__cxx03/experimental/__simd/traits.h
deleted file mode 100644
index fbaca2660e433..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/traits.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_TRAITS_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_TRAITS_H
-
-#include <__cxx03/__bit/bit_ceil.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/utility.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-
-// traits [simd.traits]
-template <class _Tp>
-inline constexpr bool is_abi_tag_v = false;
-
-template <class _Tp>
-struct is_abi_tag : bool_constant<is_abi_tag_v<_Tp>> {};
-
-template <class _Tp>
-inline constexpr bool is_simd_v = false;
-
-template <class _Tp>
-struct is_simd : bool_constant<is_simd_v<_Tp>> {};
-
-template <class _Tp>
-inline constexpr bool is_simd_mask_v = false;
-
-template <class _Tp>
-struct is_simd_mask : bool_constant<is_simd_mask_v<_Tp>> {};
-
-template <class _Tp>
-inline constexpr bool is_simd_flag_type_v = false;
-
-template <class _Tp>
-struct is_simd_flag_type : bool_constant<is_simd_flag_type_v<_Tp>> {};
-
-template <class _Tp, class _Abi = simd_abi::compatible<_Tp>, bool = (__is_vectorizable_v<_Tp> && is_abi_tag_v<_Abi>)>
-struct simd_size : integral_constant<size_t, _Abi::__simd_size> {};
-
-template <class _Tp, class _Abi>
-struct simd_size<_Tp, _Abi, false> {};
-
-template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
-inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value;
-
-template <class _Tp,
- class _Up = typename _Tp::value_type,
- bool = (is_simd_v<_Tp> && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)>
-struct memory_alignment : integral_constant<size_t, std::__bit_ceil(sizeof(_Up) * _Tp::size())> {};
-
-template <class _Tp, class _Up>
-struct memory_alignment<_Tp, _Up, false> {};
-
-template <class _Tp, class _Up = typename _Tp::value_type>
-inline constexpr size_t memory_alignment_v = memory_alignment<_Tp, _Up>::value;
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_TRAITS_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/utility.h b/libcxx/include/__cxx03/experimental/__simd/utility.h
deleted file mode 100644
index c047059abf04a..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/utility.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_UTILITY_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_UTILITY_H
-
-#include <__cxx03/__type_traits/is_arithmetic.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/is_constant_evaluated.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_unsigned.h>
-#include <__cxx03/__type_traits/is_volatile.h>
-#include <__cxx03/__type_traits/void_t.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/cstdint>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/limits>
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-template <class _Tp>
-inline constexpr bool __is_vectorizable_v =
- is_arithmetic_v<_Tp> && !is_const_v<_Tp> && !is_volatile_v<_Tp> && !is_same_v<_Tp, bool>;
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI auto __choose_mask_type() {
- if constexpr (sizeof(_Tp) == 1) {
- return uint8_t{};
- } else if constexpr (sizeof(_Tp) == 2) {
- return uint16_t{};
- } else if constexpr (sizeof(_Tp) == 4) {
- return uint32_t{};
- } else if constexpr (sizeof(_Tp) == 8) {
- return uint64_t{};
- }
-# ifndef _LIBCPP_HAS_NO_INT128
- else if constexpr (sizeof(_Tp) == 16) {
- return __uint128_t{};
- }
-# endif
- else
- static_assert(sizeof(_Tp) == 0, "Unexpected size");
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI auto constexpr __set_all_bits(bool __v) {
- return __v ? (numeric_limits<decltype(__choose_mask_type<_Tp>())>::max()) : 0;
-}
-
-template <class _From, class _To, class = void>
-inline constexpr bool __is_non_narrowing_convertible_v = false;
-
-template <class _From, class _To>
-inline constexpr bool __is_non_narrowing_convertible_v<_From, _To, std::void_t<decltype(_To{std::declval<_From>()})>> =
- true;
-
-template <class _Tp, class _Up>
-inline constexpr bool __can_broadcast_v =
- (__is_vectorizable_v<_Up> && __is_non_narrowing_convertible_v<_Up, _Tp>) ||
- (!__is_vectorizable_v<_Up> && is_convertible_v<_Up, _Tp>) || is_same_v<_Up, int> ||
- (is_same_v<_Up, unsigned int> && is_unsigned_v<_Tp>);
-
-template <class _Tp, class _Generator, std::size_t _Idx, class = void>
-inline constexpr bool __is_well_formed = false;
-
-template <class _Tp, class _Generator, std::size_t _Idx>
-inline constexpr bool
- __is_well_formed<_Tp,
- _Generator,
- _Idx,
- std::void_t<decltype(std::declval<_Generator>()(integral_constant<size_t, _Idx>()))>> =
- __can_broadcast_v<_Tp, decltype(std::declval<_Generator>()(integral_constant<size_t, _Idx>()))>;
-
-template <class _Tp, class _Generator, std::size_t... _Idxes>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __can_generate(index_sequence<_Idxes...>) {
- return (true && ... && __is_well_formed<_Tp, _Generator, _Idxes>);
-}
-
-template <class _Tp, class _Generator, std::size_t _Size>
-inline constexpr bool __can_generate_v = experimental::__can_generate<_Tp, _Generator>(make_index_sequence<_Size>());
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_UTILITY_H
diff --git a/libcxx/include/__cxx03/experimental/__simd/vec_ext.h b/libcxx/include/__cxx03/experimental/__simd/vec_ext.h
deleted file mode 100644
index a77fbc31fe836..0000000000000
--- a/libcxx/include/__cxx03/experimental/__simd/vec_ext.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL___SIMD_VEC_EXT_H
-#define _LIBCPP___CXX03_EXPERIMENTAL___SIMD_VEC_EXT_H
-
-#include <__cxx03/__assert>
-#include <__cxx03/__bit/bit_ceil.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/traits.h>
-#include <__cxx03/experimental/__simd/utility.h>
-
-#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-
-_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-inline namespace parallelism_v2 {
-namespace simd_abi {
-template <int _Np>
-struct __vec_ext {
- static constexpr size_t __simd_size = _Np;
-};
-} // namespace simd_abi
-
-template <int _Np>
-inline constexpr bool is_abi_tag_v<simd_abi::__vec_ext<_Np>> = _Np > 0 && _Np <= 32;
-
-template <class _Tp, int _Np>
-struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> {
- _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
-
- _LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
- return __data[__idx];
- }
- _LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
- __data[__idx] = __v;
- }
-};
-
-template <class _Tp, int _Np>
-struct __mask_storage<_Tp, simd_abi::__vec_ext<_Np>>
- : __simd_storage<decltype(experimental::__choose_mask_type<_Tp>()), simd_abi::__vec_ext<_Np>> {};
-
-template <class _Tp, int _Np>
-struct __simd_operations<_Tp, simd_abi::__vec_ext<_Np>> {
- using _SimdStorage = __simd_storage<_Tp, simd_abi::__vec_ext<_Np>>;
- using _MaskStorage = __mask_storage<_Tp, simd_abi::__vec_ext<_Np>>;
-
- static _LIBCPP_HIDE_FROM_ABI _SimdStorage __broadcast(_Tp __v) noexcept {
- _SimdStorage __result;
- for (int __i = 0; __i < _Np; ++__i) {
- __result.__set(__i, __v);
- }
- return __result;
- }
-
- template <class _Generator, size_t... _Is>
- static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate_init(_Generator&& __g, std::index_sequence<_Is...>) {
- return _SimdStorage{{__g(std::integral_constant<size_t, _Is>())...}};
- }
-
- template <class _Generator>
- static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept {
- return __generate_init(std::forward<_Generator>(__g), std::make_index_sequence<_Np>());
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept {
- for (size_t __i = 0; __i < _Np; __i++)
- __s.__data[__i] = static_cast<_Tp>(__mem[__i]);
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI void __store(_SimdStorage __s, _Up* __mem) noexcept {
- for (size_t __i = 0; __i < _Np; __i++)
- __mem[__i] = static_cast<_Up>(__s.__data[__i]);
- }
-};
-
-template <class _Tp, int _Np>
-struct __mask_operations<_Tp, simd_abi::__vec_ext<_Np>> {
- using _MaskStorage = __mask_storage<_Tp, simd_abi::__vec_ext<_Np>>;
-
- static _LIBCPP_HIDE_FROM_ABI _MaskStorage __broadcast(bool __v) noexcept {
- _MaskStorage __result;
- auto __all_bits_v = experimental::__set_all_bits<_Tp>(__v);
- for (int __i = 0; __i < _Np; ++__i) {
- __result.__set(__i, __all_bits_v);
- }
- return __result;
- }
-
- static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept {
- for (size_t __i = 0; __i < _Np; __i++)
- __s.__data[__i] = experimental::__set_all_bits<_Tp>(__mem[__i]);
- }
-
- static _LIBCPP_HIDE_FROM_ABI void __store(_MaskStorage __s, bool* __mem) noexcept {
- for (size_t __i = 0; __i < _Np; __i++)
- __mem[__i] = static_cast<bool>(__s.__data[__i]);
- }
-};
-
-} // namespace parallelism_v2
-_LIBCPP_END_NAMESPACE_EXPERIMENTAL
-
-#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
-#endif // _LIBCPP___CXX03_EXPERIMENTAL___SIMD_VEC_EXT_H
diff --git a/libcxx/include/__cxx03/experimental/iterator b/libcxx/include/__cxx03/experimental/iterator
deleted file mode 100644
index b639c5900832d..0000000000000
--- a/libcxx/include/__cxx03/experimental/iterator
+++ /dev/null
@@ -1,127 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL_ITERATOR
-#define _LIBCPP___CXX03_EXPERIMENTAL_ITERATOR
-
-/*
-namespace std {
- namespace experimental {
- inline namespace fundamentals_v2 {
-
- template <class DelimT, class charT = char, class traits = char_traits<charT>>
- class ostream_joiner {
- public:
- typedef charT char_type;
- typedef traits traits_type;
- typedef basic_ostream<charT, traits> ostream_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- ostream_joiner(ostream_type& s, const DelimT& delimiter);
- ostream_joiner(ostream_type& s, DelimT&& delimiter);
-
- template<typename T>
- ostream_joiner& operator=(const T& value);
-
- ostream_joiner& operator*() noexcept;
- ostream_joiner& operator++() noexcept;
- ostream_joiner& operator++(int) noexcept;
- private:
- ostream_type* out_stream; // exposition only
- DelimT delim; // exposition only
- bool first_element; // exposition only
- };
-
- template <class charT, class traits, class DelimT>
- ostream_joiner<decay_t<DelimT>, charT, traits>
- make_ostream_joiner(basic_ostream<charT, traits>& os, DelimT&& delimiter);
-
- } // inline namespace fundamentals_v2
- } // namespace experimental
-} // namespace std
-
-*/
-
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/experimental/__config>
-#include <__cxx03/iterator>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 14
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS
-
-template <class _Delim, class _CharT = char, class _Traits = char_traits<_CharT>>
-class ostream_joiner {
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<char_type, traits_type> ostream_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, _Delim&& __d)
- : __output_iter_(std::addressof(__os)), __delim_(std::move(__d)), __first_(true) {}
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner(ostream_type& __os, const _Delim& __d)
- : __output_iter_(std::addressof(__os)), __delim_(__d), __first_(true) {}
-
- template <typename _Tp>
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator=(const _Tp& __v) {
- if (!__first_)
- *__output_iter_ << __delim_;
- __first_ = false;
- *__output_iter_ << __v;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator*() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++() _NOEXCEPT { return *this; }
- _LIBCPP_HIDE_FROM_ABI ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
-
-private:
- ostream_type* __output_iter_;
- _Delim __delim_;
- bool __first_;
-};
-
-template <class _CharT, class _Traits, class _Delim>
-_LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>
-make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim&& __d) {
- return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, std::forward<_Delim>(__d));
-}
-
-_LIBCPP_END_NAMESPACE_LFTS
-
-#endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/iosfwd>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_EXPERIMENTAL_ITERATOR
diff --git a/libcxx/include/__cxx03/experimental/memory b/libcxx/include/__cxx03/experimental/memory
deleted file mode 100644
index 37b271087275c..0000000000000
--- a/libcxx/include/__cxx03/experimental/memory
+++ /dev/null
@@ -1,198 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL_MEMORY
-#define _LIBCPP___CXX03_EXPERIMENTAL_MEMORY
-
-/*
- experimental/memory synopsis
-
-namespace std::experimental::inline fundamentals_v2 {
-
-template <class W> class observer_ptr {
-public:
- using element_type = W;
- using pointer = add_pointer_t<W>; // exposition-only
- using reference = add_lvalue_reference_t<W>; // exposition-only
-
- // default ctor
- constexpr observer_ptr() noexcept;
-
- // pointer-accepting ctors
- constexpr observer_ptr(nullptr_t) noexcept;
- constexpr explicit observer_ptr(pointer) noexcept;
-
- // copying ctors (in addition to compiler-generated copy ctor)
- template <class W2> constexpr observer_ptr(observer_ptr<W2>) noexcept;
-
- // observers
- constexpr pointer get() const noexcept;
- constexpr reference operator*() const;
- constexpr pointer operator->() const noexcept;
- constexpr explicit operator bool() const noexcept;
-
- // conversions
- constexpr explicit operator pointer() const noexcept;
-
- // modifiers
- constexpr pointer release() noexcept;
- constexpr void reset(pointer = nullptr) noexcept;
- constexpr void swap(observer_ptr&) noexcept;
-};
-
-}
-*/
-
-#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__type_traits/add_lvalue_reference.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifdef _LIBCPP_ENABLE_EXPERIMENTAL
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
-
-# if _LIBCPP_STD_VER >= 17
-
-template <class _Wp>
-class observer_ptr {
-public:
- using element_type = _Wp;
-
- // constructors
- _LIBCPP_HIDE_FROM_ABI constexpr observer_ptr() noexcept : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI constexpr observer_ptr(nullptr_t) noexcept : __ptr_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI constexpr explicit observer_ptr(element_type* __p) noexcept : __ptr_(__p) {}
-
- template <class _W2, __enable_if_t<is_convertible<_W2*, _Wp*>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr observer_ptr(observer_ptr<_W2> __other) noexcept : __ptr_(__other.get()) {}
-
- // observers
- _LIBCPP_HIDE_FROM_ABI constexpr element_type* get() const noexcept { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI constexpr add_lvalue_reference_t<_Wp> operator*() const { return *__ptr_; }
- _LIBCPP_HIDE_FROM_ABI constexpr element_type* operator->() const noexcept { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __ptr_ != nullptr; }
-
- // conversions
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator element_type*() const noexcept { return __ptr_; }
-
- // modifiers
- _LIBCPP_HIDE_FROM_ABI constexpr void reset(element_type* __p = nullptr) noexcept { __ptr_ = __p; }
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(observer_ptr& __other) noexcept {
- observer_ptr __tmp = __other;
- __other = *this;
- *this = __tmp;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr element_type* release() noexcept {
- observer_ptr __p;
- __p.swap(*this);
- return __p.get();
- }
-
-private:
- element_type* __ptr_;
-};
-
-// specializations
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI constexpr void swap(observer_ptr<_Wp>& __a, observer_ptr<_Wp>& __b) noexcept {
- __a.swap(__b);
-}
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI observer_ptr<_Wp> make_observer(_Wp* __ptr) noexcept {
- return observer_ptr<_Wp>{__ptr};
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator==(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return __a.get() == __b.get();
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator!=(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return !(__a == __b);
-}
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI bool operator==(observer_ptr<_Wp> __p, nullptr_t) {
- return !__p;
-}
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, observer_ptr<_Wp> __p) {
- return !__p;
-}
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI bool operator!=(observer_ptr<_Wp> __p, nullptr_t) {
- return (bool)__p;
-}
-
-template <class _Wp>
-_LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, observer_ptr<_Wp> __p) {
- return (bool)__p;
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator<(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return std::less<typename std::common_type<_W1*, _W2*>::type>()(__a.get(), __b.get());
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator>(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return __b < __a;
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator<=(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return !(__a > __b);
-}
-
-template <class _W1, class _W2>
-_LIBCPP_HIDE_FROM_ABI bool operator>=(observer_ptr<_W1> __a, observer_ptr<_W2> __b) {
- return !(__a < __b);
-}
-
-# endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_LFTS_V2
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// hash
-
-# if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-struct hash<experimental::observer_ptr<_Tp>> {
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::observer_ptr<_Tp>& __ptr) const noexcept {
- return hash<_Tp*>()(__ptr.get());
- }
-};
-# endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_ENABLE_EXPERIMENTAL
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/limits>
-#endif
-
-#endif /* _LIBCPP___CXX03_EXPERIMENTAL_MEMORY */
diff --git a/libcxx/include/__cxx03/experimental/propagate_const b/libcxx/include/__cxx03/experimental/propagate_const
deleted file mode 100644
index 7fc9d35ba8f3d..0000000000000
--- a/libcxx/include/__cxx03/experimental/propagate_const
+++ /dev/null
@@ -1,490 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL_PROPAGATE_CONST
-#define _LIBCPP___CXX03_EXPERIMENTAL_PROPAGATE_CONST
-
-/*
- propagate_const synopsis
-
- namespace std { namespace experimental { inline namespace fundamentals_v2 {
-
- // [propagate_const]
- template <class T> class propagate_const;
-
- // [propagate_const.underlying], underlying pointer access
- constexpr const _Tp& get_underlying(const propagate_const<T>& pt) noexcept;
- constexpr T& get_underlying(propagate_const<T>& pt) noexcept;
-
- // [propagate_const.relational], relational operators
- template <class T> constexpr bool operator==(const propagate_const<T>& pt, nullptr_t);
- template <class T> constexpr bool operator==(nullptr_t, const propagate_const<T>& pu);
- template <class T> constexpr bool operator!=(const propagate_const<T>& pt, nullptr_t);
- template <class T> constexpr bool operator!=(nullptr_t, const propagate_const<T>& pu);
- template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator==(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator!=(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator<(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator>(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator<=(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator>=(const propagate_const<T>& pt, const _Up& u);
- template <class T, class U> constexpr bool operator==(const _Tp& t, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator!=(const _Tp& t, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator<(const _Tp& t, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator>(const _Tp& t, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator<=(const _Tp& t, const propagate_const<_Up>& pu);
- template <class T, class U> constexpr bool operator>=(const _Tp& t, const propagate_const<_Up>& pu);
-
- // [propagate_const.algorithms], specialized algorithms
- template <class T> constexpr void swap(propagate_const<T>& pt, propagate_const<T>& pu) noexcept(see below);
-
- template <class T>
- class propagate_const
- {
-
- public:
- typedef remove_reference_t<decltype(*declval<T&>())> element_type;
-
- // [propagate_const.ctor], constructors
- constexpr propagate_const() = default;
- propagate_const(const propagate_const& p) = delete;
- constexpr propagate_const(propagate_const&& p) = default;
- template <class U> EXPLICIT constexpr propagate_const(propagate_const<_Up>&& pu); // see below
- template <class U> EXPLICIT constexpr propagate_const(U&& u); // see below
-
- // [propagate_const.assignment], assignment
- propagate_const& operator=(const propagate_const& p) = delete;
- constexpr propagate_const& operator=(propagate_const&& p) = default;
- template <class U> constexpr propagate_const& operator=(propagate_const<_Up>&& pu);
- template <class U> constexpr propagate_const& operator=(U&& u); // see below
-
- // [propagate_const.const_observers], const observers
- explicit constexpr operator bool() const;
- constexpr const element_type* operator->() const;
- constexpr operator const element_type*() const; // Not always defined
- constexpr const element_type& operator*() const;
- constexpr const element_type* get() const;
-
- // [propagate_const.non_const_observers], non-const observers
- constexpr element_type* operator->();
- constexpr operator element_type*(); // Not always defined
- constexpr element_type& operator*();
- constexpr element_type* get();
-
- // [propagate_const.modifiers], modifiers
- constexpr void swap(propagate_const& pt) noexcept(see below)
-
- private:
- T t_; // exposition only
- };
-
- } // namespace fundamentals_v2
- } // namespace experimental
-
- // [propagate_const.hash], hash support
- template <class T> struct hash<experimental::propagate_const<T>>;
-
- // [propagate_const.comparison_function_objects], comparison function objects
- template <class T> struct equal_to<experimental::propagate_const<T>>;
- template <class T> struct not_equal_to<experimental::propagate_const<T>>;
- template <class T> struct less<experimental::propagate_const<T>>;
- template <class T> struct greater<experimental::propagate_const<T>>;
- template <class T> struct less_equal<experimental::propagate_const<T>>;
- template <class T> struct greater_equal<experimental::propagate_const<T>>;
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__fwd/functional.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_function.h>
-#include <__cxx03/__type_traits/is_pointer.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_swappable.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_pointer.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/experimental/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-#if _LIBCPP_STD_VER >= 14
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
-
-template <class _Tp>
-class propagate_const;
-
-template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI constexpr const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
-
-template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
-
-template <class _Tp>
-class propagate_const {
-public:
- typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type;
-
- static_assert(!is_array<_Tp>::value, "Instantiation of propagate_const with an array type is ill-formed.");
- static_assert(!is_reference<_Tp>::value, "Instantiation of propagate_const with a reference type is ill-formed.");
- static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value),
- "Instantiation of propagate_const with a function-pointer type is ill-formed.");
- static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value),
- "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed.");
-
-private:
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr element_type* __get_pointer(_Up* __u) {
- return __u;
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr element_type* __get_pointer(_Up& __u) {
- return __get_pointer(__u.get());
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr const element_type* __get_pointer(const _Up* __u) {
- return __u;
- }
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr const element_type* __get_pointer(const _Up& __u) {
- return __get_pointer(__u.get());
- }
-
- template <class _Up>
- struct __is_propagate_const : false_type {};
-
- template <class _Up>
- struct __is_propagate_const<propagate_const<_Up>> : true_type {};
-
- _Tp __t_;
-
-public:
- template <class _Up>
- friend constexpr const _Up& experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
- template <class _Up>
- friend constexpr _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
-
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const() = default;
-
- propagate_const(const propagate_const&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const&&) = default;
-
- template <class _Up,
- enable_if_t<!is_convertible<_Up, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu))) {}
-
- template <class _Up,
- enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = false>
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const<_Up>&& __pu)
- : __t_(std::move(experimental::get_underlying(__pu))) {}
-
- template <class _Up,
- enable_if_t<!is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,
- bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
-
- template <class _Up,
- enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
- !__is_propagate_const<decay_t<_Up>>::value,
- bool> = false>
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
-
- propagate_const& operator=(const propagate_const&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(propagate_const&&) = default;
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(propagate_const<_Up>&& __pu) {
- __t_ = std::move(experimental::get_underlying(__pu));
- return *this;
- }
-
- template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
- _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(_Up&& __u) {
- __t_ = std::forward<_Up>(__u);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const element_type* get() const { return __get_pointer(__t_); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr element_type* get() { return __get_pointer(__t_); }
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr operator bool() const { return get() != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const element_type* operator->() const { return get(); }
-
- template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible< const _Dummy, const element_type*>::value>>
- _LIBCPP_HIDE_FROM_ABI constexpr operator const element_type*() const {
- return get();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const element_type& operator*() const { return *get(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr element_type* operator->() { return get(); }
-
- template <class _Dummy = _Tp, class _Up = enable_if_t< is_convertible<_Dummy, element_type*>::value>>
- _LIBCPP_HIDE_FROM_ABI constexpr operator element_type*() {
- return get();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr element_type& operator*() { return *get(); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(propagate_const& __pt) noexcept(__is_nothrow_swappable_v<_Tp>) {
- using std::swap;
- swap(__t_, __pt.__t_);
- }
-};
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) {
- return experimental::get_underlying(__pt) == nullptr;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) {
- return nullptr == experimental::get_underlying(__pt);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) {
- return experimental::get_underlying(__pt) != nullptr;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) {
- return nullptr != experimental::get_underlying(__pt);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) == experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) != experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) < experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) > experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) <= experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
- return experimental::get_underlying(__pt) >= experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) == __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) != __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) < __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) > __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) <= __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) {
- return experimental::get_underlying(__pt) >= __u;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t == experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t != experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t < experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t > experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t <= experimental::get_underlying(__pu);
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) {
- return __t >= experimental::get_underlying(__pu);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr void
-swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) noexcept(__is_nothrow_swappable_v<_Tp>) {
- __pc1.swap(__pc2);
-}
-
-template <class _Tp>
-constexpr const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT {
- return __pt.__t_;
-}
-
-template <class _Tp>
-constexpr _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT {
- return __pt.__t_;
-}
-
-_LIBCPP_END_NAMESPACE_LFTS_V2
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp>
-struct hash<experimental::propagate_const<_Tp>> {
- typedef size_t result_type;
- typedef experimental::propagate_const<_Tp> argument_type;
-
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const {
- return std::hash<_Tp>()(experimental::get_underlying(__pc1));
- }
-};
-
-template <class _Tp>
-struct equal_to<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-template <class _Tp>
-struct not_equal_to<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::not_equal_to<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-template <class _Tp>
-struct less<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::less<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-template <class _Tp>
-struct greater<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::greater<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-template <class _Tp>
-struct less_equal<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::less_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-template <class _Tp>
-struct greater_equal<experimental::propagate_const<_Tp>> {
- typedef experimental::propagate_const<_Tp> first_argument_type;
- typedef experimental::propagate_const<_Tp> second_argument_type;
-
- _LIBCPP_HIDE_FROM_ABI bool
- operator()(const experimental::propagate_const<_Tp>& __pc1, const experimental::propagate_const<_Tp>& __pc2) const {
- return std::greater_equal<_Tp>()(experimental::get_underlying(__pc1), experimental::get_underlying(__pc2));
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_EXPERIMENTAL_PROPAGATE_CONST
diff --git a/libcxx/include/__cxx03/experimental/simd b/libcxx/include/__cxx03/experimental/simd
deleted file mode 100644
index 553f97594c5ce..0000000000000
--- a/libcxx/include/__cxx03/experimental/simd
+++ /dev/null
@@ -1,88 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL_SIMD
-#define _LIBCPP___CXX03_EXPERIMENTAL_SIMD
-
-/*
- experimental/simd synopsis
-
-namespace std::experimental {
-inline namespace parallelism_v2 {
- namespace simd_abi {
- using scalar = see below;
- template<int N> using fixed_size = see below;
- template<class T> inline constexpr int max_fixed_size = implementation-defined;
- template<class T> using compatible = implementation-defined;
- template<class T> using native = implementation-defined;
-
- template<class T, size_t N, class... Abis> struct deduce { using type = see below; };
- template<class T, size_t N, class... Abis> using deduce_t =
- typename deduce<T, N, Abis...>::type;
- } // namespace simd_abi
-
- // class template simd [simd.class]
- template <class T, class Abi = simd_abi::compatible<T>> class simd;
- template <class T> using native_simd = simd<T, simd_abi::native<T>>;
- template <class T, int N> using fixed_size_simd = simd<T, simd_abi::fixed_size<N>>;
-
- // class template simd_mask [simd.mask.class]
- template <class T, class Abi = simd_abi::compatible<T>> class simd_mask;
- template <class T> using native_simd_mask = simd_mask<T, simd_abi::native<T>>;
- template <class T, int N> using fixed_size_simd_mask = simd_mask<T, simd_abi::fixed_size<N>>;
-
- // memory alignment
- struct element_aligned_tag {};
- struct vector_aligned_tag {};
- template <size_t> struct overaligned_tag {};
- inline constexpr element_aligned_tag element_aligned{};
- inline constexpr vector_aligned_tag vector_aligned{};
- template <size_t N> inline constexpr overaligned_tag<N> overaligned{};
-
- // traits [simd.traits]
- template<class T> struct is_abi_tag;
- template<class T> inline constexpr bool is_abi_tag_v = is_abi_tag<T>::value;
-
- template <class T> struct is_simd;
- template <class T> inline constexpr bool is_simd_v = is_simd<T>::value;
-
- template <class T> struct is_simd_mask;
- template <class T> inline constexpr bool is_simd_mask_v = is_simd_mask<T>::value;
-
- template<class T> struct is_simd_flag_type;
- template<class T> inline constexpr bool is_simd_flag_type_v = is_simd_flag_type<T>::value;
-
- template<class T, class Abi = simd_abi::compatible<T>> struct simd_size;
- template<class T, class Abi = simd_abi::compatible<T>>
- inline constexpr size_t simd_size_v = simd_size<T,Abi>::value;
-
- template<class T, class U = typename T::value_type> struct memory_alignment;
- template<class T, class U = typename T::value_type>
- inline constexpr size_t memory_alignment_v = memory_alignment<T,U>::value;
-
-} // namespace parallelism_v2
-} // namespace std::experimental
-
-*/
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#include <__cxx03/experimental/__config>
-#include <__cxx03/experimental/__simd/aligned_tag.h>
-#include <__cxx03/experimental/__simd/declaration.h>
-#include <__cxx03/experimental/__simd/reference.h>
-#include <__cxx03/experimental/__simd/scalar.h>
-#include <__cxx03/experimental/__simd/simd.h>
-#include <__cxx03/experimental/__simd/simd_mask.h>
-#include <__cxx03/experimental/__simd/traits.h>
-#include <__cxx03/experimental/__simd/vec_ext.h>
-
-#endif /* _LIBCPP___CXX03_EXPERIMENTAL_SIMD */
diff --git a/libcxx/include/__cxx03/experimental/type_traits b/libcxx/include/__cxx03/experimental/type_traits
deleted file mode 100644
index c7cfef14a3c06..0000000000000
--- a/libcxx/include/__cxx03/experimental/type_traits
+++ /dev/null
@@ -1,153 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_EXPERIMENTAL_TYPE_TRAITS
-#define _LIBCPP___CXX03_EXPERIMENTAL_TYPE_TRAITS
-
-/**
- experimental/type_traits synopsis
-
-// C++1y
-#include <__cxx03/type_traits>
-
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-
- // 3.3.2, Other type transformations
- template <class> class invocation_type; // not defined
- template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
- template <class> class raw_invocation_type; // not defined
- template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
-
- template <class T>
- using invocation_type_t = typename invocation_type<T>::type;
- template <class T>
- using raw_invocation_type_t = typename raw_invocation_type<T>::type;
-
- // 3.3.4, Detection idiom
- template <class...> using void_t = void;
-
- struct nonesuch {
- nonesuch() = delete;
- ~nonesuch() = delete;
- nonesuch(nonesuch const&) = delete;
- void operator=(nonesuch const&) = delete;
- };
-
- template <template<class...> class Op, class... Args>
- using is_detected = see below;
- template <template<class...> class Op, class... Args>
- constexpr bool is_detected_v = is_detected<Op, Args...>::value;
- template <template<class...> class Op, class... Args>
- using detected_t = see below;
- template <class Default, template<class...> class Op, class... Args>
- using detected_or = see below;
- template <class Default, template<class...> class Op, class... Args>
- using detected_or_t = typename detected_or<Default, Op, Args...>::type;
- template <class Expected, template<class...> class Op, class... Args>
- using is_detected_exact = is_same<Expected, detected_t<Op, Args...>>;
- template <class Expected, template<class...> class Op, class... Args>
- constexpr bool is_detected_exact_v
- = is_detected_exact<Expected, Op, Args...>::value;
- template <class To, template<class...> class Op, class... Args>
- using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
- template <class To, template<class...> class Op, class... Args>
- constexpr bool is_detected_convertible_v
- = is_detected_convertible<To, Op, Args...>::value;
-
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__cxx03/experimental/__config>
-
-#if _LIBCPP_STD_VER >= 14
-
-# include <__cxx03/initializer_list>
-# include <__cxx03/type_traits>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS
-
-// 3.3.2, Other type transformations
-/*
-template <class>
-class _LIBCPP_TEMPLATE_VIS raw_invocation_type;
-
-template <class _Fn, class ..._Args>
-class _LIBCPP_TEMPLATE_VIS raw_invocation_type<_Fn(_Args...)>;
-
-template <class>
-class _LIBCPP_TEMPLATE_VIS invokation_type;
-
-template <class _Fn, class ..._Args>
-class _LIBCPP_TEMPLATE_VIS invokation_type<_Fn(_Args...)>;
-
-template <class _Tp>
-using invokation_type_t = typename invokation_type<_Tp>::type;
-
-template <class _Tp>
-using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
-*/
-
-// 3.3.4, Detection idiom
-template <class...>
-using void_t = void;
-
-struct nonesuch : private __nat { // make nonesuch "not an aggregate"
- ~nonesuch() = delete;
- nonesuch(nonesuch const&) = delete;
- void operator=(nonesuch const&) = delete;
-};
-
-template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
-struct _DETECTOR {
- using value_t = false_type;
- using type = _Default;
-};
-
-template <class _Default, template <class...> class _Op, class... _Args>
-struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
- using value_t = true_type;
- using type = _Op<_Args...>;
-};
-
-template <template <class...> class _Op, class... _Args>
-using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
-template <template <class...> class _Op, class... _Args>
-using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
-template <template <class...> class _Op, class... _Args>
-constexpr bool is_detected_v = is_detected<_Op, _Args...>::value;
-
-template <class _Default, template <class...> class _Op, class... _Args>
-using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
-template <class _Default, template <class...> class _Op, class... _Args>
-using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-
-template <class _Expected, template <class...> class _Op, class... _Args>
-using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
-template <class _Expected, template <class...> class _Op, class... _Args>
-constexpr bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
-
-template <class _To, template <class...> class _Op, class... _Args>
-using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
-template <class _To, template <class...> class _Op, class... _Args>
-constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
-
-_LIBCPP_END_NAMESPACE_LFTS
-
-#endif /* _LIBCPP_STD_VER >= 14 */
-
-#endif /* _LIBCPP___CXX03_EXPERIMENTAL_TYPE_TRAITS */
diff --git a/libcxx/include/__cxx03/experimental/utility b/libcxx/include/__cxx03/experimental/utility
index 4e8156ae8728f..95b6dcb595382 100644
--- a/libcxx/include/__cxx03/experimental/utility
+++ b/libcxx/include/__cxx03/experimental/utility
@@ -12,22 +12,16 @@
/*
experimental/utility synopsis
-
// C++1y
-
#include <__cxx03/utility>
-
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
-
3.1.2, erased-type placeholder
struct erased_type { };
-
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
-
*/
#include <__cxx03/experimental/__config>
diff --git a/libcxx/include/__cxx03/ext/hash_map b/libcxx/include/__cxx03/ext/hash_map
index f075ed19ea40f..97d2f57586b70 100644
--- a/libcxx/include/__cxx03/ext/hash_map
+++ b/libcxx/include/__cxx03/ext/hash_map
@@ -864,7 +864,6 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Has
} // namespace __gnu_cxx
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/iterator>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/ext/hash_set b/libcxx/include/__cxx03/ext/hash_set
index fefad7c5833b1..2708105d9fb97 100644
--- a/libcxx/include/__cxx03/ext/hash_set
+++ b/libcxx/include/__cxx03/ext/hash_set
@@ -576,7 +576,6 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash,
} // namespace __gnu_cxx
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/iterator>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/filesystem b/libcxx/include/__cxx03/filesystem
deleted file mode 100644
index c991e15b923a9..0000000000000
--- a/libcxx/include/__cxx03/filesystem
+++ /dev/null
@@ -1,577 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_FILESYSTEM
-#define _LIBCPP___CXX03_FILESYSTEM
-
-/*
- filesystem synopsis
-
- namespace std::filesystem {
-
- // `class path` from http://eel.is/c++draft/fs.class.path.general#6
- class path {
- public:
- using value_type = see below;
- using string_type = basic_string<value_type>;
- static constexpr value_type preferred_separator = see below;
-
- enum format;
-
- path() noexcept;
- path(const path& p);
- path(path&& p) noexcept;
- path(string_type&& source, format fmt = auto_format);
- template<class Source>
- path(const Source& source, format fmt = auto_format);
- template<class InputIterator>
- path(InputIterator first, InputIterator last, format fmt = auto_format);
- template<class Source>
- path(const Source& source, const locale& loc, format fmt = auto_format);
- template<class InputIterator>
- path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
- ~path();
-
- path& operator=(const path& p);
- path& operator=(path&& p) noexcept;
- path& operator=(string_type&& source);
- path& assign(string_type&& source);
- template<class Source>
- path& operator=(const Source& source);
- template<class Source>
- path& assign(const Source& source);
- template<class InputIterator>
- path& assign(InputIterator first, InputIterator last);
-
- path& operator/=(const path& p);
- template<class Source>
- path& operator/=(const Source& source);
- template<class Source>
- path& append(const Source& source);
- template<class InputIterator>
- path& append(InputIterator first, InputIterator last);
-
- path& operator+=(const path& x);
- path& operator+=(const string_type& x);
- path& operator+=(basic_string_view<value_type> x);
- path& operator+=(const value_type* x);
- path& operator+=(value_type x);
- template<class Source>
- path& operator+=(const Source& x);
- template<class EcharT>
- path& operator+=(EcharT x);
- template<class Source>
- path& concat(const Source& x);
- template<class InputIterator>
- path& concat(InputIterator first, InputIterator last);
-
- void clear() noexcept;
- path& make_preferred();
- path& remove_filename();
- path& replace_filename(const path& replacement);
- path& replace_extension(const path& replacement = path());
- void swap(path& rhs) noexcept;
-
- friend bool operator==(const path& lhs, const path& rhs) noexcept;
- friend bool operator!=(const path& lhs, const path& rhs) noexcept; // removed in C++20
- friend bool operator< (const path& lhs, const path& rhs) noexcept; // removed in C++20
- friend bool operator<=(const path& lhs, const path& rhs) noexcept; // removed in C++20
- friend bool operator> (const path& lhs, const path& rhs) noexcept; // removed in C++20
- friend bool operator>=(const path& lhs, const path& rhs) noexcept; // removed in C++20
- friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept; // C++20
-
- friend path operator/(const path& lhs, const path& rhs);
-
- const string_type& native() const noexcept;
- const value_type* c_str() const noexcept;
- operator string_type() const;
-
- template<class EcharT, class traits = char_traits<EcharT>,
- class Allocator = allocator<EcharT>>
- basic_string<EcharT, traits, Allocator>
- string(const Allocator& a = Allocator()) const;
- std::string string() const;
- std::wstring wstring() const;
- std::u8string u8string() const;
- std::u16string u16string() const;
- std::u32string u32string() const;
-
- template<class EcharT, class traits = char_traits<EcharT>,
- class Allocator = allocator<EcharT>>
- basic_string<EcharT, traits, Allocator>
- generic_string(const Allocator& a = Allocator()) const;
- std::string generic_string() const;
- std::wstring generic_wstring() const;
- std::u8string generic_u8string() const;
- std::u16string generic_u16string() const;
- std::u32string generic_u32string() const;
-
- int compare(const path& p) const noexcept;
- int compare(const string_type& s) const;
- int compare(basic_string_view<value_type> s) const;
- int compare(const value_type* s) const;
-
- path root_name() const;
- path root_directory() const;
- path root_path() const;
- path relative_path() const;
- path parent_path() const;
- path filename() const;
- path stem() const;
- path extension() const;
-
- [[nodiscard]] bool empty() const noexcept;
- bool has_root_name() const;
- bool has_root_directory() const;
- bool has_root_path() const;
- bool has_relative_path() const;
- bool has_parent_path() const;
- bool has_filename() const;
- bool has_stem() const;
- bool has_extension() const;
- bool is_absolute() const;
- bool is_relative() const;
-
- path lexically_normal() const;
- path lexically_relative(const path& base) const;
- path lexically_proximate(const path& base) const;
-
- class iterator;
- using const_iterator = iterator;
-
- iterator begin() const;
- iterator end() const;
-
- template<class charT, class traits>
- friend basic_ostream<charT, traits>&
- operator<<(basic_ostream<charT, traits>& os, const path& p);
- template<class charT, class traits>
- friend basic_istream<charT, traits>&
- operator>>(basic_istream<charT, traits>& is, path& p);
- };
-
- void swap(path& lhs, path& rhs) noexcept;
- size_t hash_value(const path& p) noexcept;
-
- // [fs.path.hash], hash support
- template<> struct hash<filesystem::path>;
-
- template <class Source>
- path u8path(const Source& source);
- template <class InputIterator>
- path u8path(InputIterator first, InputIterator last);
-
- class filesystem_error;
-
- class directory_entry {
- public:
- directory_entry() noexcept = default;
- directory_entry(const directory_entry&) = default;
- directory_entry(directory_entry&&) noexcept = default;
- explicit directory_entry(const filesystem::path& p);
- directory_entry(const filesystem::path& p, error_code& ec);
- ~directory_entry();
-
- directory_entry& operator=(const directory_entry&) = default;
- directory_entry& operator=(directory_entry&&) noexcept = default;
-
- void assign(const filesystem::path& p);
- void assign(const filesystem::path& p, error_code& ec);
- void replace_filename(const filesystem::path& p);
- void replace_filename(const filesystem::path& p, error_code& ec);
- void refresh();
- void refresh(error_code& ec) noexcept;
-
- const filesystem::path& path() const noexcept;
- operator const filesystem::path&() const noexcept;
- bool exists() const;
- bool exists(error_code& ec) const noexcept;
- bool is_block_file() const;
- bool is_block_file(error_code& ec) const noexcept;
- bool is_character_file() const;
- bool is_character_file(error_code& ec) const noexcept;
- bool is_directory() const;
- bool is_directory(error_code& ec) const noexcept;
- bool is_fifo() const;
- bool is_fifo(error_code& ec) const noexcept;
- bool is_other() const;
- bool is_other(error_code& ec) const noexcept;
- bool is_regular_file() const;
- bool is_regular_file(error_code& ec) const noexcept;
- bool is_socket() const;
- bool is_socket(error_code& ec) const noexcept;
- bool is_symlink() const;
- bool is_symlink(error_code& ec) const noexcept;
- uintmax_t file_size() const;
- uintmax_t file_size(error_code& ec) const noexcept;
- uintmax_t hard_link_count() const;
- uintmax_t hard_link_count(error_code& ec) const noexcept;
- file_time_type last_write_time() const;
- file_time_type last_write_time(error_code& ec) const noexcept;
- file_status status() const;
- file_status status(error_code& ec) const noexcept;
- file_status symlink_status() const;
- file_status symlink_status(error_code& ec) const noexcept;
-
- bool operator==(const directory_entry& rhs) const noexcept;
- bool operator!=(const directory_entry& rhs) const noexcept; // removed in C++20
- bool operator< (const directory_entry& rhs) const noexcept; // removed in C++20
- bool operator<=(const directory_entry& rhs) const noexcept; // removed in C++20
- bool operator> (const directory_entry& rhs) const noexcept; // removed in C++20
- bool operator>=(const directory_entry& rhs) const noexcept; // removed in C++20
- strong_ordering operator<=>(const directory_entry& rhs) const noexcept; // since C++20
-
- template<class charT, class traits>
- friend basic_ostream<charT, traits>&
- operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
-
- private:
- filesystem::path pathobject; // exposition only
- friend class directory_iterator; // exposition only
- };
-
- class directory_iterator {
- public:
- using iterator_category = input_iterator_tag;
- using value_type = directory_entry;
- using difference_type = ptrdiff_t;
- using pointer = const directory_entry*;
- using reference = const directory_entry&;
-
- // [fs.dir.itr.members], member functions
- directory_iterator() noexcept;
- explicit directory_iterator(const path& p);
- directory_iterator(const path& p, directory_options options);
- directory_iterator(const path& p, error_code& ec);
- directory_iterator(const path& p, directory_options options,
- error_code& ec);
- directory_iterator(const directory_iterator& rhs);
- directory_iterator(directory_iterator&& rhs) noexcept;
- ~directory_iterator();
-
- directory_iterator& operator=(const directory_iterator& rhs);
- directory_iterator& operator=(directory_iterator&& rhs) noexcept;
-
- const directory_entry& operator*() const;
- const directory_entry* operator->() const;
- directory_iterator& operator++();
- directory_iterator& increment(error_code& ec);
-
- bool operator==(default_sentinel_t) const noexcept { // since C++20
- return *this == directory_iterator();
- }
-
- // other members as required by [input.iterators], input iterators
- };
-
- // enable directory_iterator range-based for statements
- directory_iterator begin(directory_iterator iter) noexcept;
- directory_iterator end(directory_iterator) noexcept;
-
-class recursive_directory_iterator {
- public:
- using iterator_category = input_iterator_tag;
- using value_type = directory_entry;
- using difference_type = ptrdiff_t;
- using pointer = const directory_entry*;
- using reference = const directory_entry&;
-
- // [fs.rec.dir.itr.members], constructors and destructor
- recursive_directory_iterator() noexcept;
- explicit recursive_directory_iterator(const path& p);
- recursive_directory_iterator(const path& p, directory_options options);
- recursive_directory_iterator(const path& p, directory_options options,
- error_code& ec);
- recursive_directory_iterator(const path& p, error_code& ec);
- recursive_directory_iterator(const recursive_directory_iterator& rhs);
- recursive_directory_iterator(recursive_directory_iterator&& rhs) noexcept;
- ~recursive_directory_iterator();
-
- // [fs.rec.dir.itr.members], observers
- directory_options options() const;
- int depth() const;
- bool recursion_pending() const;
-
- const directory_entry& operator*() const;
- const directory_entry* operator->() const;
-
- // [fs.rec.dir.itr.members], modifiers
- recursive_directory_iterator&
- operator=(const recursive_directory_iterator& rhs);
- recursive_directory_iterator&
- operator=(recursive_directory_iterator&& rhs) noexcept;
-
- recursive_directory_iterator& operator++();
- recursive_directory_iterator& increment(error_code& ec);
-
- void pop();
- void pop(error_code& ec);
- void disable_recursion_pending();
-
- bool operator==(default_sentinel_t) const noexcept { // since C++20
- return *this == recursive_directory_iterator();
- }
-
- // other members as required by [input.iterators], input iterators
- };
-
- // enable recursive_directory_iterator range-based for statements
- recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
- recursive_directory_iterator end(recursive_directory_iterator) noexcept;
-
- class file_status {
- public:
- // [fs.file.status.cons], constructors and destructor
- file_status() noexcept : file_status(file_type::none) {}
- explicit file_status(file_type ft,
- perms prms = perms::unknown) noexcept;
- file_status(const file_status&) noexcept = default;
- file_status(file_status&&) noexcept = default;
- ~file_status();
-
- // assignments
- file_status& operator=(const file_status&) noexcept = default;
- file_status& operator=(file_status&&) noexcept = default;
-
- // [fs.file.status.mods], modifiers
- void type(file_type ft) noexcept;
- void permissions(perms prms) noexcept;
-
- // [fs.file.status.obs], observers
- file_type type() const noexcept;
- perms permissions() const noexcept;
-
- friend bool operator==(const file_status& lhs, const file_status& rhs) noexcept
- { return lhs.type() == rhs.type() && lhs.permissions() == rhs.permissions(); } // C++20
- };
-
- struct space_info
- {
- uintmax_t capacity;
- uintmax_t free;
- uintmax_t available;
-
- friend bool operator==(const space_info&, const space_info&) = default; // C++20
- };
-
- enum class file_type;
- enum class perms;
- enum class perm_options;
- enum class copy_options;
- enum class directory_options;
-
- typedef chrono::time_point<trivial-clock> file_time_type;
-
- // operational functions
-
- path absolute(const path& p);
- path absolute(const path& p, error_code &ec);
-
- path canonical(const path& p);
- path canonical(const path& p, error_code& ec);
-
- void copy(const path& from, const path& to);
- void copy(const path& from, const path& to, error_code& ec);
- void copy(const path& from, const path& to, copy_options options);
- void copy(const path& from, const path& to, copy_options options,
- error_code& ec);
-
- bool copy_file(const path& from, const path& to);
- bool copy_file(const path& from, const path& to, error_code& ec);
- bool copy_file(const path& from, const path& to, copy_options option);
- bool copy_file(const path& from, const path& to, copy_options option,
- error_code& ec);
-
- void copy_symlink(const path& existing_symlink, const path& new_symlink);
- void copy_symlink(const path& existing_symlink, const path& new_symlink,
- error_code& ec) noexcept;
-
- bool create_directories(const path& p);
- bool create_directories(const path& p, error_code& ec);
-
- bool create_directory(const path& p);
- bool create_directory(const path& p, error_code& ec) noexcept;
-
- bool create_directory(const path& p, const path& attributes);
- bool create_directory(const path& p, const path& attributes,
- error_code& ec) noexcept;
-
- void create_directory_symlink(const path& to, const path& new_symlink);
- void create_directory_symlink(const path& to, const path& new_symlink,
- error_code& ec) noexcept;
-
- void create_hard_link(const path& to, const path& new_hard_link);
- void create_hard_link(const path& to, const path& new_hard_link,
- error_code& ec) noexcept;
-
- void create_symlink(const path& to, const path& new_symlink);
- void create_symlink(const path& to, const path& new_symlink,
- error_code& ec) noexcept;
-
- path current_path();
- path current_path(error_code& ec);
- void current_path(const path& p);
- void current_path(const path& p, error_code& ec) noexcept;
-
- bool exists(file_status s) noexcept;
- bool exists(const path& p);
- bool exists(const path& p, error_code& ec) noexcept;
-
- bool equivalent(const path& p1, const path& p2);
- bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
-
- uintmax_t file_size(const path& p);
- uintmax_t file_size(const path& p, error_code& ec) noexcept;
-
- uintmax_t hard_link_count(const path& p);
- uintmax_t hard_link_count(const path& p, error_code& ec) noexcept;
-
- bool is_block_file(file_status s) noexcept;
- bool is_block_file(const path& p);
- bool is_block_file(const path& p, error_code& ec) noexcept;
-
- bool is_character_file(file_status s) noexcept;
- bool is_character_file(const path& p);
- bool is_character_file(const path& p, error_code& ec) noexcept;
-
- bool is_directory(file_status s) noexcept;
- bool is_directory(const path& p);
- bool is_directory(const path& p, error_code& ec) noexcept;
-
- bool is_empty(const path& p);
- bool is_empty(const path& p, error_code& ec) noexcept;
-
- bool is_fifo(file_status s) noexcept;
- bool is_fifo(const path& p);
- bool is_fifo(const path& p, error_code& ec) noexcept;
-
- bool is_other(file_status s) noexcept;
- bool is_other(const path& p);
- bool is_other(const path& p, error_code& ec) noexcept;
-
- bool is_regular_file(file_status s) noexcept;
- bool is_regular_file(const path& p);
- bool is_regular_file(const path& p, error_code& ec) noexcept;
-
- bool is_socket(file_status s) noexcept;
- bool is_socket(const path& p);
- bool is_socket(const path& p, error_code& ec) noexcept;
-
- bool is_symlink(file_status s) noexcept;
- bool is_symlink(const path& p);
- bool is_symlink(const path& p, error_code& ec) noexcept;
-
- file_time_type last_write_time(const path& p);
- file_time_type last_write_time(const path& p, error_code& ec) noexcept;
- void last_write_time(const path& p, file_time_type new_time);
- void last_write_time(const path& p, file_time_type new_time,
- error_code& ec) noexcept;
-
- void permissions(const path& p, perms prms,
- perm_options opts=perm_options::replace);
- void permissions(const path& p, perms prms, error_code& ec) noexcept;
- void permissions(const path& p, perms prms, perm_options opts,
- error_code& ec);
-
- path proximate(const path& p, error_code& ec);
- path proximate(const path& p, const path& base = current_path());
- path proximate(const path& p, const path& base, error_code &ec);
-
- path read_symlink(const path& p);
- path read_symlink(const path& p, error_code& ec);
-
- path relative(const path& p, error_code& ec);
- path relative(const path& p, const path& base=current_path());
- path relative(const path& p, const path& base, error_code& ec);
-
- bool remove(const path& p);
- bool remove(const path& p, error_code& ec) noexcept;
-
- uintmax_t remove_all(const path& p);
- uintmax_t remove_all(const path& p, error_code& ec);
-
- void rename(const path& from, const path& to);
- void rename(const path& from, const path& to, error_code& ec) noexcept;
-
- void resize_file(const path& p, uintmax_t size);
- void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept;
-
- space_info space(const path& p);
- space_info space(const path& p, error_code& ec) noexcept;
-
- file_status status(const path& p);
- file_status status(const path& p, error_code& ec) noexcept;
-
- bool status_known(file_status s) noexcept;
-
- file_status symlink_status(const path& p);
- file_status symlink_status(const path& p, error_code& ec) noexcept;
-
- path temp_directory_path();
- path temp_directory_path(error_code& ec);
-
- path weakly_canonical(path const& p);
- path weakly_canonical(path const& p, error_code& ec);
-
-} // namespace std::filesystem
-
-template <>
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
-template <>
-inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
-
-template <>
-inline constexpr bool std::ranges::enable_view<std::filesystem::directory_iterator> = true;
-template <>
-inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__filesystem/copy_options.h>
-# include <__cxx03/__filesystem/directory_entry.h>
-# include <__cxx03/__filesystem/directory_iterator.h>
-# include <__cxx03/__filesystem/directory_options.h>
-# include <__cxx03/__filesystem/file_status.h>
-# include <__cxx03/__filesystem/file_time_type.h>
-# include <__cxx03/__filesystem/file_type.h>
-# include <__cxx03/__filesystem/filesystem_error.h>
-# include <__cxx03/__filesystem/operations.h>
-# include <__cxx03/__filesystem/path.h>
-# include <__cxx03/__filesystem/path_iterator.h>
-# include <__cxx03/__filesystem/perm_options.h>
-# include <__cxx03/__filesystem/perms.h>
-# include <__cxx03/__filesystem/recursive_directory_iterator.h>
-# include <__cxx03/__filesystem/space_info.h>
-# include <__cxx03/__filesystem/u8path.h>
-#endif
-
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [fs.filesystem.syn]
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
-# include <__cxx03/cstdlib>
-# include <__cxx03/cstring>
-# include <__cxx03/iosfwd>
-# include <__cxx03/new>
-# include <__cxx03/system_error>
-#endif
-
-#endif // _LIBCPP___CXX03_FILESYSTEM
diff --git a/libcxx/include/__cxx03/format b/libcxx/include/__cxx03/format
deleted file mode 100644
index 0183f8374efd1..0000000000000
--- a/libcxx/include/__cxx03/format
+++ /dev/null
@@ -1,257 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_FORMAT
-#define _LIBCPP___CXX03_FORMAT
-
-/*
-
-namespace std {
- // [format.context], class template basic_format_context
- template<class Out, class charT> class basic_format_context;
- using format_context = basic_format_context<unspecified, char>;
- using wformat_context = basic_format_context<unspecified, wchar_t>;
-
- // [format.args], class template basic_format_args
- template<class Context> class basic_format_args;
- using format_args = basic_format_args<format_context>;
- using wformat_args = basic_format_args<wformat_context>;
-
- // [format.fmt.string], class template basic_format_string
- template<class charT, class... Args>
- struct basic_format_string { // since C++23, exposition only before C++23
- private:
- basic_string_view<charT> str; // exposition only
-
- public:
- template<class T> consteval basic_format_string(const T& s);
- basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {} // since C++26
-
- constexpr basic_string_view<charT> get() const noexcept { return str; }
- };
- template<class... Args>
- using format_string = // since C++23, exposition only before C++23
- basic_format_string<char, type_identity_t<Args>...>;
- template<class... Args>
- using wformat_string = // since C++23, exposition only before C++23
- basic_format_string<wchar_t, type_identity_t<Args>...>;
-
- template<class charT> struct runtime-format-string { // since C++26, exposition-only
- private:
- basic_string_view<charT> str; // exposition-only
-
- public:
- runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}
-
- runtime-format-string(const runtime-format-string&) = delete;
- runtime-format-string& operator=(const runtime-format-string&) = delete;
- };
-
- runtime-format-string<char> runtime_format(string_view fmt) noexcept {
- return fmt;
- }
- runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept {
- return fmt;
- }
-
- // [format.functions], formatting functions
- template<class... Args>
- string format(format-string<Args...> fmt, Args&&... args);
- template<class... Args>
- wstring format(wformat-string<Args...> fmt, Args&&... args);
- template<class... Args>
- string format(const locale& loc, format-string<Args...> fmt, Args&&... args);
- template<class... Args>
- wstring format(const locale& loc, wformat-string<Args...> fmt, Args&&... args);
-
- string vformat(string_view fmt, format_args args);
- wstring vformat(wstring_view fmt, wformat_args args);
- string vformat(const locale& loc, string_view fmt, format_args args);
- wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
-
- template<class Out, class... Args>
- Out format_to(Out out, format-string<Args...> fmt, Args&&... args);
- template<class Out, class... Args>
- Out format_to(Out out, wformat-string<Args...> fmt, Args&&... args);
- template<class Out, class... Args>
- Out format_to(Out out, const locale& loc, format-string<Args...> fmt, Args&&... args);
- template<class Out, class... Args>
- Out format_to(Out out, const locale& loc, wformat-string<Args...> fmt, Args&&... args);
-
- template<class Out>
- Out vformat_to(Out out, string_view fmt, format_args args);
- template<class Out>
- Out vformat_to(Out out, wstring_view fmt, wformat_args args);
- template<class Out>
- Out vformat_to(Out out, const locale& loc, string_view fmt,
- format_args char> args);
- template<class Out>
- Out vformat_to(Out out, const locale& loc, wstring_view fmt,
- wformat_args args);
-
- template<class Out> struct format_to_n_result {
- Out out;
- iter_difference_t<Out> size;
- };
- template<class Out, class... Args>
- format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
- format-string<Args...> fmt, Args&&... args);
- template<class Out, class... Args>
- format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
- wformat-string<Args...> fmt, Args&&... args);
- template<class Out, class... Args>
- format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
- const locale& loc, format-string<Args...> fmt,
- Args&&... args);
- template<class Out, class... Args>
- format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
- const locale& loc, wformat-string<Args...> fmt,
- Args&&... args);
-
- template<class... Args>
- size_t formatted_size(format-string<Args...> fmt, Args&&... args);
- template<class... Args>
- size_t formatted_size(wformat-string<Args...> fmt, Args&&... args);
- template<class... Args>
- size_t formatted_size(const locale& loc, format-string<Args...> fmt, Args&&... args);
- template<class... Args>
- size_t formatted_size(const locale& loc, wformat-string<Args...> fmt, Args&&... args);
-
- // [format.formatter], formatter
- template<class T, class charT = char> struct formatter;
-
- // [format.parse.ctx], class template basic_format_parse_context
- template<class charT> class basic_format_parse_context;
- using format_parse_context = basic_format_parse_context<char>;
- using wformat_parse_context = basic_format_parse_context<wchar_t>;
-
- // [format.range], formatting of ranges
- // [format.range.fmtkind], variable template format_kind
- enum class range_format { // since C++23
- disabled,
- map,
- set,
- sequence,
- string,
- debug_string
- };
-
- template<class R>
- constexpr unspecified format_kind = unspecified; // since C++23
-
- template<ranges::input_range R>
- requires same_as<R, remove_cvref_t<R>>
- constexpr range_format format_kind<R> = see below; // since C++23
-
- // [format.range.formatter], class template range_formatter
- template<class T, class charT = char>
- requires same_as<remove_cvref_t<T>, T> && formattable<T, charT>
- class range_formatter; // since C++23
-
- // [format.range.fmtdef], class template range-default-formatter
- template<range_format K, ranges::input_range R, class charT>
- struct range-default-formatter; // exposition only, since C++23
-
- // [format.range.fmtmap], [format.range.fmtset], [format.range.fmtstr],
- // specializations for maps, sets, and strings
- template<ranges::input_range R, class charT>
- requires (format_kind<R> != range_format::disabled) &&
- formattable<ranges::range_reference_t<R>, charT>
- struct formatter<R, charT> : range-default-formatter<format_kind<R>, R, charT> { }; // since C++23
-
- // [format.arguments], arguments
- // [format.arg], class template basic_format_arg
- template<class Context> class basic_format_arg;
-
- template<class Visitor, class Context>
- see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg); // Deprecated in C++26
-
- // [format.arg.store], class template format-arg-store
- template<class Context, class... Args> struct format-arg-store; // exposition only
-
- template<class Context = format_context, class... Args>
- format-arg-store<Context, Args...>
- make_format_args(Args&... args);
- template<class... Args>
- format-arg-store<wformat_context, Args...>
- make_wformat_args(Args&... args);
-
- // [format.error], class format_error
- class format_error;
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__format/buffer.h>
-# include <__cxx03/__format/concepts.h>
-# include <__cxx03/__format/container_adaptor.h>
-# include <__cxx03/__format/enable_insertable.h>
-# include <__cxx03/__format/escaped_output_table.h>
-# include <__cxx03/__format/extended_grapheme_cluster_table.h>
-# include <__cxx03/__format/format_arg.h>
-# include <__cxx03/__format/format_arg_store.h>
-# include <__cxx03/__format/format_args.h>
-# include <__cxx03/__format/format_context.h>
-# include <__cxx03/__format/format_error.h>
-# include <__cxx03/__format/format_functions.h>
-# include <__cxx03/__format/format_parse_context.h>
-# include <__cxx03/__format/format_string.h>
-# include <__cxx03/__format/format_to_n_result.h>
-# include <__cxx03/__format/formatter.h>
-# include <__cxx03/__format/formatter_bool.h>
-# include <__cxx03/__format/formatter_char.h>
-# include <__cxx03/__format/formatter_floating_point.h>
-# include <__cxx03/__format/formatter_integer.h>
-# include <__cxx03/__format/formatter_pointer.h>
-# include <__cxx03/__format/formatter_string.h>
-# include <__cxx03/__format/formatter_tuple.h>
-# include <__cxx03/__format/parser_std_format_spec.h>
-# include <__cxx03/__format/range_default_formatter.h>
-# include <__cxx03/__format/range_formatter.h>
-# include <__cxx03/__format/unicode.h>
-# include <__cxx03/__fwd/format.h>
-#endif
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/array>
-# include <__cxx03/cctype>
-# include <__cxx03/cerrno>
-# include <__cxx03/clocale>
-# include <__cxx03/cmath>
-# include <__cxx03/cstddef>
-# include <__cxx03/cstdint>
-# include <__cxx03/cstdlib>
-# include <__cxx03/cstring>
-# include <__cxx03/initializer_list>
-# include <__cxx03/limits>
-# include <__cxx03/locale>
-# include <__cxx03/new>
-# include <__cxx03/optional>
-# include <__cxx03/queue>
-# include <__cxx03/stack>
-# include <__cxx03/stdexcept>
-# include <__cxx03/string>
-# include <__cxx03/string_view>
-# include <__cxx03/tuple>
-
-# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
-# include <__cxx03/cwchar>
-# endif
-#endif
-
-#endif // _LIBCPP___CXX03_FORMAT
diff --git a/libcxx/include/__cxx03/forward_list b/libcxx/include/__cxx03/forward_list
index ecffb9c8f3a10..6bd969af8769b 100644
--- a/libcxx/include/__cxx03/forward_list
+++ b/libcxx/include/__cxx03/forward_list
@@ -197,7 +197,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__algorithm/comp.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__algorithm/min.h>
#include <__cxx03/__config>
#include <__cxx03/__iterator/distance.h>
@@ -212,11 +211,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__memory/construct_at.h>
#include <__cxx03/__memory/pointer_traits.h>
#include <__cxx03/__memory/swap_allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__type_traits/is_const.h>
@@ -236,14 +230,6 @@ template <class T, class Allocator, class Predicate>
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [forward.list.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -1559,7 +1545,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdint>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
diff --git a/libcxx/include/__cxx03/fstream b/libcxx/include/__cxx03/fstream
index 7e43a533fd794..da6927af37b6f 100644
--- a/libcxx/include/__cxx03/fstream
+++ b/libcxx/include/__cxx03/fstream
@@ -197,7 +197,6 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__cxx03/__utility/swap.h>
#include <__cxx03/__utility/unreachable.h>
#include <__cxx03/cstdio>
-#include <__cxx03/filesystem>
#include <__cxx03/istream>
#include <__cxx03/ostream>
#include <__cxx03/typeinfo>
@@ -1559,7 +1558,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iosfwd>
# include <__cxx03/limits>
diff --git a/libcxx/include/__cxx03/functional b/libcxx/include/__cxx03/functional
index 985fcfa953204..b6a6643ece83d 100644
--- a/libcxx/include/__cxx03/functional
+++ b/libcxx/include/__cxx03/functional
@@ -544,22 +544,8 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#include <__cxx03/__functional/unary_function.h>
#include <__cxx03/__functional/unary_negate.h>
-#ifndef _LIBCPP_CXX03_LANG
-# include <__cxx03/__functional/function.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__functional/boyer_moore_searcher.h>
-# include <__cxx03/__functional/default_searcher.h>
-# include <__cxx03/__functional/invoke.h>
-# include <__cxx03/__functional/not_fn.h>
-#endif
-
#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__functional/bind_back.h>
-# include <__cxx03/__functional/bind_front.h>
# include <__cxx03/__functional/identity.h>
-# include <__cxx03/__functional/ranges_operations.h>
# include <__cxx03/__type_traits/unwrap_ref.h>
#endif
@@ -576,20 +562,17 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
# include <__cxx03/array>
-# include <__cxx03/initializer_list>
# include <__cxx03/unordered_map>
# include <__cxx03/vector>
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/exception>
# include <__cxx03/iosfwd>
# include <__cxx03/memory>
# include <__cxx03/stdexcept>
-# include <__cxx03/tuple>
# include <__cxx03/type_traits>
# include <__cxx03/typeinfo>
# include <__cxx03/utility>
diff --git a/libcxx/include/__cxx03/initializer_list b/libcxx/include/__cxx03/initializer_list
deleted file mode 100644
index 4bb2deb01ae6d..0000000000000
--- a/libcxx/include/__cxx03/initializer_list
+++ /dev/null
@@ -1,98 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_INITIALIZER_LIST
-#define _LIBCPP___CXX03_INITIALIZER_LIST
-
-/*
- initializer_list synopsis
-
-namespace std
-{
-
-template<class E>
-class initializer_list
-{
-public:
- typedef E value_type;
- typedef const E& reference;
- typedef const E& const_reference;
- typedef size_t size_type;
-
- typedef const E* iterator;
- typedef const E* const_iterator;
-
- initializer_list() noexcept; // constexpr in C++14
-
- size_t size() const noexcept; // constexpr in C++14
- const E* begin() const noexcept; // constexpr in C++14
- const E* end() const noexcept; // constexpr in C++14
-};
-
-template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
-template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
-
-} // std
-
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/cstddef>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-namespace std // purposefully not versioned
-{
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Ep>
-class _LIBCPP_TEMPLATE_VIS initializer_list {
- const _Ep* __begin_;
- size_t __size_;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
- : __begin_(__b),
- __size_(__s) {}
-
-public:
- typedef _Ep value_type;
- typedef const _Ep& reference;
- typedef const _Ep& const_reference;
- typedef size_t size_type;
-
- typedef const _Ep* iterator;
- typedef const _Ep* const_iterator;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t size() const _NOEXCEPT { return __size_; }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin() const _NOEXCEPT { return __begin_; }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end() const _NOEXCEPT { return __begin_ + __size_; }
-};
-
-template <class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* begin(initializer_list<_Ep> __il) _NOEXCEPT {
- return __il.begin();
-}
-
-template <class _Ep>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initializer_list<_Ep> __il) _NOEXCEPT {
- return __il.end();
-}
-
-#endif // !defined(_LIBCPP_CXX03_LANG)
-
-} // namespace std
-
-#endif // _LIBCPP___CXX03_INITIALIZER_LIST
diff --git a/libcxx/include/__cxx03/ios b/libcxx/include/__cxx03/ios
index ace6d666d6b58..ca3253508e1ae 100644
--- a/libcxx/include/__cxx03/ios
+++ b/libcxx/include/__cxx03/ios
@@ -872,11 +872,9 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstddef>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
-# include <__cxx03/initializer_list>
# include <__cxx03/limits>
# include <__cxx03/mutex>
# include <__cxx03/new>
diff --git a/libcxx/include/__cxx03/istream b/libcxx/include/__cxx03/istream
index b1f7b0888d71b..22d603b811326 100644
--- a/libcxx/include/__cxx03/istream
+++ b/libcxx/include/__cxx03/istream
@@ -1362,7 +1362,6 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>;
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/iosfwd>
# include <__cxx03/ostream>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/iterator b/libcxx/include/__cxx03/iterator
index 5ac8a4274b3dd..10da19a059ca9 100644
--- a/libcxx/include/__cxx03/iterator
+++ b/libcxx/include/__cxx03/iterator
@@ -698,50 +698,14 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <__cxx03/__iterator/reverse_iterator.h>
#include <__cxx03/__iterator/wrap_iter.h>
-#if _LIBCPP_STD_VER >= 14
-# include <__cxx03/__iterator/reverse_access.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__iterator/data.h>
-# include <__cxx03/__iterator/empty.h>
-# include <__cxx03/__iterator/size.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__iterator/common_iterator.h>
-# include <__cxx03/__iterator/concepts.h>
-# include <__cxx03/__iterator/counted_iterator.h>
-# include <__cxx03/__iterator/default_sentinel.h>
-# include <__cxx03/__iterator/incrementable_traits.h>
-# include <__cxx03/__iterator/indirectly_comparable.h>
-# include <__cxx03/__iterator/iter_move.h>
-# include <__cxx03/__iterator/iter_swap.h>
-# include <__cxx03/__iterator/mergeable.h>
-# include <__cxx03/__iterator/move_sentinel.h>
-# include <__cxx03/__iterator/permutable.h>
-# include <__cxx03/__iterator/projected.h>
-# include <__cxx03/__iterator/readable_traits.h>
-# include <__cxx03/__iterator/sortable.h>
-# include <__cxx03/__iterator/unreachable_sentinel.h>
-#endif
-
#include <__cxx03/version>
// standard-mandated includes
-// [iterator.synopsis]
-#include <__cxx03/compare>
-#include <__cxx03/concepts>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/variant>
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/cstdlib>
# include <__cxx03/exception>
diff --git a/libcxx/include/__cxx03/latch b/libcxx/include/__cxx03/latch
deleted file mode 100644
index cca88c594039b..0000000000000
--- a/libcxx/include/__cxx03/latch
+++ /dev/null
@@ -1,129 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_LATCH
-#define _LIBCPP___CXX03_LATCH
-
-/*
- latch synopsis
-
-namespace std
-{
-
- class latch
- {
- public:
- static constexpr ptrdiff_t max() noexcept;
-
- constexpr explicit latch(ptrdiff_t __expected);
- ~latch();
-
- latch(const latch&) = delete;
- latch& operator=(const latch&) = delete;
-
- void count_down(ptrdiff_t __update = 1);
- bool try_wait() const noexcept;
- void wait() const;
- void arrive_and_wait(ptrdiff_t __update = 1);
-
- private:
- ptrdiff_t __counter; // exposition only
- };
-
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-
-# include <__cxx03/__assert>
-# include <__cxx03/__atomic/atomic_base.h>
-# include <__cxx03/__atomic/atomic_sync.h>
-# include <__cxx03/__atomic/memory_order.h>
-# include <__cxx03/cstddef>
-# include <__cxx03/limits>
-# include <__cxx03/version>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-# if _LIBCPP_STD_VER >= 14
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-class _LIBCPP_DEPRECATED_ATOMIC_SYNC latch {
- __atomic_base<ptrdiff_t> __a_;
-
-public:
- static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
-
- inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __expected >= 0,
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __expected <= max(),
- "latch::latch(ptrdiff_t): latch cannot be "
- "initialized with a value greater than max()");
- }
-
- _LIBCPP_HIDE_FROM_ABI ~latch() = default;
- latch(const latch&) = delete;
- latch& operator=(const latch&) = delete;
-
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::count_down called with a negative value");
- auto const __old = __a_.fetch_sub(__update, memory_order_release);
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __update <= __old,
- "latch::count_down called with a value greater "
- "than the internal counter");
- if (__old == __update)
- __a_.notify_all();
- }
- inline _LIBCPP_HIDE_FROM_ABI bool try_wait() const noexcept {
- auto __value = __a_.load(memory_order_acquire);
- return try_wait_impl(__value);
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait() const {
- std::__atomic_wait_unless(
- __a_, [this](ptrdiff_t& __value) -> bool { return try_wait_impl(__value); }, memory_order_acquire);
- }
- inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::arrive_and_wait called with a negative value");
- // other preconditions on __update are checked in count_down()
-
- count_down(__update);
- wait();
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI bool try_wait_impl(ptrdiff_t& __value) const noexcept { return __value == 0; }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-# endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-#endif
-
-#endif //_LIBCPP___CXX03_LATCH
diff --git a/libcxx/include/__cxx03/list b/libcxx/include/__cxx03/list
index 647bb770646ca..3b8215367939e 100644
--- a/libcxx/include/__cxx03/list
+++ b/libcxx/include/__cxx03/list
@@ -200,11 +200,9 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__algorithm/comp.h>
#include <__cxx03/__algorithm/equal.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__algorithm/min.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
-#include <__cxx03/__format/enable_insertable.h>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/move_iterator.h>
@@ -219,11 +217,6 @@ template <class T, class Allocator, class Predicate>
#include <__cxx03/__memory/construct_at.h>
#include <__cxx03/__memory/pointer_traits.h>
#include <__cxx03/__memory/swap_allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__type_traits/conditional.h>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__type_traits/is_nothrow_assignable.h>
@@ -243,14 +236,6 @@ template <class T, class Allocator, class Predicate>
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [list.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -1728,7 +1713,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdint>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
diff --git a/libcxx/include/__cxx03/locale b/libcxx/include/__cxx03/locale
index 6360bbc2f6b60..7355d966900b7 100644
--- a/libcxx/include/__cxx03/locale
+++ b/libcxx/include/__cxx03/locale
@@ -3755,7 +3755,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdarg>
# include <__cxx03/iterator>
# include <__cxx03/mutex>
diff --git a/libcxx/include/__cxx03/map b/libcxx/include/__cxx03/map
index bd03d8b741a71..62ed5b23643fd 100644
--- a/libcxx/include/__cxx03/map
+++ b/libcxx/include/__cxx03/map
@@ -573,7 +573,6 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <__cxx03/__algorithm/equal.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__functional/binary_function.h>
@@ -581,36 +580,21 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <__cxx03/__functional/operations.h>
#include <__cxx03/__iterator/erase_if_container.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/ranges_iterator_traits.h>
#include <__cxx03/__iterator/reverse_iterator.h>
#include <__cxx03/__memory/addressof.h>
#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__node_handle>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__tree>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/__utility/piecewise_construct.h>
#include <__cxx03/__utility/swap.h>
#include <__cxx03/stdexcept>
-#include <__cxx03/tuple>
#include <__cxx03/version>
// standard-mandated includes
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [associative.map.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -2170,7 +2154,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
# include <__cxx03/iterator>
diff --git a/libcxx/include/__cxx03/mdspan b/libcxx/include/__cxx03/mdspan
deleted file mode 100644
index c47a63794955b..0000000000000
--- a/libcxx/include/__cxx03/mdspan
+++ /dev/null
@@ -1,438 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===---------------------------------------------------------------------===//
-
-/*
-
-// Overall mdspan synopsis
-
-namespace std {
- // [mdspan.extents], class template extents
- template<class IndexType, size_t... Extents>
- class extents;
-
- // [mdspan.extents.dextents], alias template dextents
- template<class IndexType, size_t Rank>
- using dextents = see below;
-
- // [mdspan.extents.dims], alias template dims
- template<size_t Rank, class IndexType = size_t>
- using dims = see below; // since C++26
-
- // [mdspan.layout], layout mapping
- struct layout_left;
- struct layout_right;
- struct layout_stride;
-
- // [mdspan.accessor.default], class template default_accessor
- template<class ElementType>
- class default_accessor;
-
- // [mdspan.mdspan], class template mdspan
- template<class ElementType, class Extents, class LayoutPolicy = layout_right,
- class AccessorPolicy = default_accessor<ElementType>>
- class mdspan; // not implemented yet
-}
-
-// extents synopsis
-
-namespace std {
- template<class _IndexType, size_t... _Extents>
- class extents {
- public:
- using index_type = _IndexType;
- using size_type = make_unsigned_t<index_type>;
- using rank_type = size_t;
-
- // [mdspan.extents.obs], observers of the multidimensional index space
- static constexpr rank_type rank() noexcept { return sizeof...(_Extents); }
- static constexpr rank_type rank_dynamic() noexcept { return dynamic-index(rank()); }
- static constexpr size_t static_extent(rank_type) noexcept;
- constexpr index_type extent(rank_type) const noexcept;
-
- // [mdspan.extents.cons], constructors
- constexpr extents() noexcept = default;
-
- template<class _OtherIndexType, size_t... _OtherExtents>
- constexpr explicit(see below)
- extents(const extents<_OtherIndexType, _OtherExtents...>&) noexcept;
- template<class... _OtherIndexTypes>
- constexpr explicit extents(_OtherIndexTypes...) noexcept;
- template<class _OtherIndexType, size_t N>
- constexpr explicit(N != rank_dynamic())
- extents(span<_OtherIndexType, N>) noexcept;
- template<class _OtherIndexType, size_t N>
- constexpr explicit(N != rank_dynamic())
- extents(const array<_OtherIndexType, N>&) noexcept;
-
- // [mdspan.extents.cmp], comparison operators
- template<class _OtherIndexType, size_t... _OtherExtents>
- friend constexpr bool operator==(const extents&,
- const extents<_OtherIndexType, _OtherExtents...>&) noexcept;
-
- private:
- // libcxx note: we do not use an array here, but we need to preserve the as-if behavior
- // for example the default constructor must zero initialize dynamic extents
- array<index_type, rank_dynamic()> dynamic-extents{}; // exposition only
- };
-
- template<class... Integrals>
- explicit extents(Integrals...)
- -> see below;
-}
-
-// layout_left synopsis
-
-namespace std {
- template<class Extents>
- class layout_left::mapping {
- public:
- using extents_type = Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_left;
-
- // [mdspan.layout.right.cons], constructors
- constexpr mapping() noexcept = default;
- constexpr mapping(const mapping&) noexcept = default;
- constexpr mapping(const extents_type&) noexcept;
- template<class OtherExtents>
- constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
- mapping(const mapping<OtherExtents>&) noexcept;
- template<class OtherExtents>
- constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
- mapping(const layout_right::mapping<OtherExtents>&) noexcept;
- template<class OtherExtents>
- constexpr explicit(extents_type::rank() > 0)
- mapping(const layout_stride::mapping<OtherExtents>&) noexcept;
-
- constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.right.obs], observers
- constexpr const extents_type& extents() const noexcept { return extents_; }
-
- constexpr index_type required_span_size() const noexcept;
-
- template<class... Indices>
- constexpr index_type operator()(Indices...) const noexcept;
-
- static constexpr bool is_always_unique() noexcept { return true; }
- static constexpr bool is_always_exhaustive() noexcept { return true; }
- static constexpr bool is_always_strided() noexcept { return true; }
-
- static constexpr bool is_unique() noexcept { return true; }
- static constexpr bool is_exhaustive() noexcept { return true; }
- static constexpr bool is_strided() noexcept { return true; }
-
- constexpr index_type stride(rank_type) const noexcept;
-
- template<class OtherExtents>
- friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept;
-
- private:
- extents_type extents_{}; // exposition only
- };
-}
-
-// layout_right synopsis
-
-namespace std {
- template<class Extents>
- class layout_right::mapping {
- public:
- using extents_type = Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_right;
-
- // [mdspan.layout.right.cons], constructors
- constexpr mapping() noexcept = default;
- constexpr mapping(const mapping&) noexcept = default;
- constexpr mapping(const extents_type&) noexcept;
- template<class OtherExtents>
- constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
- mapping(const mapping<OtherExtents>&) noexcept;
- template<class OtherExtents>
- constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
- mapping(const layout_left::mapping<OtherExtents>&) noexcept;
- template<class OtherExtents>
- constexpr explicit(extents_type::rank() > 0)
- mapping(const layout_stride::mapping<OtherExtents>&) noexcept;
-
- constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.right.obs], observers
- constexpr const extents_type& extents() const noexcept { return extents_; }
-
- constexpr index_type required_span_size() const noexcept;
-
- template<class... Indices>
- constexpr index_type operator()(Indices...) const noexcept;
-
- static constexpr bool is_always_unique() noexcept { return true; }
- static constexpr bool is_always_exhaustive() noexcept { return true; }
- static constexpr bool is_always_strided() noexcept { return true; }
-
- static constexpr bool is_unique() noexcept { return true; }
- static constexpr bool is_exhaustive() noexcept { return true; }
- static constexpr bool is_strided() noexcept { return true; }
-
- constexpr index_type stride(rank_type) const noexcept;
-
- template<class OtherExtents>
- friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept;
-
- private:
- extents_type extents_{}; // exposition only
- };
-}
-
-// layout_stride synopsis
-
-namespace std {
- template<class Extents>
- class layout_stride::mapping {
- public:
- using extents_type = Extents;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using layout_type = layout_stride;
-
- private:
- static constexpr rank_type rank_ = extents_type::rank(); // exposition only
-
- public:
- // [mdspan.layout.stride.cons], constructors
- constexpr mapping() noexcept;
- constexpr mapping(const mapping&) noexcept = default;
- template<class OtherIndexType>
- constexpr mapping(const extents_type&, span<OtherIndexType, rank_>) noexcept;
- template<class OtherIndexType>
- constexpr mapping(const extents_type&, const array<OtherIndexType, rank_>&) noexcept;
-
- template<class StridedLayoutMapping>
- constexpr explicit(see below) mapping(const StridedLayoutMapping&) noexcept;
-
- constexpr mapping& operator=(const mapping&) noexcept = default;
-
- // [mdspan.layout.stride.obs], observers
- constexpr const extents_type& extents() const noexcept { return extents_; }
- constexpr array<index_type, rank_> strides() const noexcept { return strides_; }
-
- constexpr index_type required_span_size() const noexcept;
-
- template<class... Indices>
- constexpr index_type operator()(Indices...) const noexcept;
-
- static constexpr bool is_always_unique() noexcept { return true; }
- static constexpr bool is_always_exhaustive() noexcept { return false; }
- static constexpr bool is_always_strided() noexcept { return true; }
-
- static constexpr bool is_unique() noexcept { return true; }
- constexpr bool is_exhaustive() const noexcept;
- static constexpr bool is_strided() noexcept { return true; }
-
- constexpr index_type stride(rank_type i) const noexcept { return strides_[i]; }
-
- template<class OtherMapping>
- friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept;
-
- private:
- extents_type extents_{}; // exposition only
- array<index_type, rank_> strides_{}; // exposition only
- };
-}
-
-// default_accessor synopsis
-
-namespace std {
- template<class ElementType>
- struct default_accessor {
- using offset_policy = default_accessor;
- using element_type = ElementType;
- using reference = ElementType&;
- using data_handle_type = ElementType*;
-
- constexpr default_accessor() noexcept = default;
- template<class OtherElementType>
- constexpr default_accessor(default_accessor<OtherElementType>) noexcept;
- constexpr reference access(data_handle_type p, size_t i) const noexcept;
- constexpr data_handle_type offset(data_handle_type p, size_t i) const noexcept;
- };
-}
-
-// mdspan synopsis
-
-namespace std {
- template<class ElementType, class Extents, class LayoutPolicy = layout_right,
- class AccessorPolicy = default_accessor<ElementType>>
- class mdspan {
- public:
- using extents_type = Extents;
- using layout_type = LayoutPolicy;
- using accessor_type = AccessorPolicy;
- using mapping_type = typename layout_type::template mapping<extents_type>;
- using element_type = ElementType;
- using value_type = remove_cv_t<element_type>;
- using index_type = typename extents_type::index_type;
- using size_type = typename extents_type::size_type;
- using rank_type = typename extents_type::rank_type;
- using data_handle_type = typename accessor_type::data_handle_type;
- using reference = typename accessor_type::reference;
-
- static constexpr rank_type rank() noexcept { return extents_type::rank(); }
- static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
- static constexpr size_t static_extent(rank_type r) noexcept
- { return extents_type::static_extent(r); }
- constexpr index_type extent(rank_type r) const noexcept { return extents().extent(r); }
-
- // [mdspan.mdspan.cons], constructors
- constexpr mdspan();
- constexpr mdspan(const mdspan& rhs) = default;
- constexpr mdspan(mdspan&& rhs) = default;
-
- template<class... OtherIndexTypes>
- constexpr explicit mdspan(data_handle_type ptr, OtherIndexTypes... exts);
- template<class OtherIndexType, size_t N>
- constexpr explicit(N != rank_dynamic())
- mdspan(data_handle_type p, span<OtherIndexType, N> exts);
- template<class OtherIndexType, size_t N>
- constexpr explicit(N != rank_dynamic())
- mdspan(data_handle_type p, const array<OtherIndexType, N>& exts);
- constexpr mdspan(data_handle_type p, const extents_type& ext);
- constexpr mdspan(data_handle_type p, const mapping_type& m);
- constexpr mdspan(data_handle_type p, const mapping_type& m, const accessor_type& a);
-
- template<class OtherElementType, class OtherExtents,
- class OtherLayoutPolicy, class OtherAccessorPolicy>
- constexpr explicit(see below)
- mdspan(const mdspan<OtherElementType, OtherExtents,
- OtherLayoutPolicy, OtherAccessorPolicy>& other);
-
- constexpr mdspan& operator=(const mdspan& rhs) = default;
- constexpr mdspan& operator=(mdspan&& rhs) = default;
-
- // [mdspan.mdspan.members], members
- template<class... OtherIndexTypes>
- constexpr reference operator[](OtherIndexTypes... indices) const;
- template<class OtherIndexType>
- constexpr reference operator[](span<OtherIndexType, rank()> indices) const;
- template<class OtherIndexType>
- constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const;
-
- constexpr size_type size() const noexcept;
- [[nodiscard]] constexpr bool empty() const noexcept;
-
- friend constexpr void swap(mdspan& x, mdspan& y) noexcept;
-
- constexpr const extents_type& extents() const noexcept { return map_.extents(); }
- constexpr const data_handle_type& data_handle() const noexcept { return ptr_; }
- constexpr const mapping_type& mapping() const noexcept { return map_; }
- constexpr const accessor_type& accessor() const noexcept { return acc_; }
-
- // per LWG-4021 "mdspan::is_always_meow() should be noexcept"
- static constexpr bool is_always_unique() noexcept
- { return mapping_type::is_always_unique(); }
- static constexpr bool is_always_exhaustive() noexcept
- { return mapping_type::is_always_exhaustive(); }
- static constexpr bool is_always_strided() noexcept
- { return mapping_type::is_always_strided(); }
-
- constexpr bool is_unique() const
- { return map_.is_unique(); }
- constexpr bool is_exhaustive() const
- { return map_.is_exhaustive(); }
- constexpr bool is_strided() const
- { return map_.is_strided(); }
- constexpr index_type stride(rank_type r) const
- { return map_.stride(r); }
-
- private:
- accessor_type acc_; // exposition only
- mapping_type map_; // exposition only
- data_handle_type ptr_; // exposition only
- };
-
- template<class CArray>
- requires(is_array_v<CArray> && rank_v<CArray> == 1)
- mdspan(CArray&)
- -> mdspan<remove_all_extents_t<CArray>, extents<size_t, extent_v<CArray, 0>>>;
-
- template<class Pointer>
- requires(is_pointer_v<remove_reference_t<Pointer>>)
- mdspan(Pointer&&)
- -> mdspan<remove_pointer_t<remove_reference_t<Pointer>>, extents<size_t>>;
-
- template<class ElementType, class... Integrals>
- requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
- explicit mdspan(ElementType*, Integrals...)
- -> mdspan<ElementType, dextents<size_t, sizeof...(Integrals)>>; // until C++26
- template<class ElementType, class... Integrals>
- requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
- explicit mdspan(ElementType*, Integrals...)
- -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals>...>>; // since C++26
-
- template<class ElementType, class OtherIndexType, size_t N>
- mdspan(ElementType*, span<OtherIndexType, N>)
- -> mdspan<ElementType, dextents<size_t, N>>;
-
- template<class ElementType, class OtherIndexType, size_t N>
- mdspan(ElementType*, const array<OtherIndexType, N>&)
- -> mdspan<ElementType, dextents<size_t, N>>;
-
- template<class ElementType, class IndexType, size_t... ExtentsPack>
- mdspan(ElementType*, const extents<IndexType, ExtentsPack...>&)
- -> mdspan<ElementType, extents<IndexType, ExtentsPack...>>;
-
- template<class ElementType, class MappingType>
- mdspan(ElementType*, const MappingType&)
- -> mdspan<ElementType, typename MappingType::extents_type,
- typename MappingType::layout_type>;
-
- template<class MappingType, class AccessorType>
- mdspan(const typename AccessorType::data_handle_type&, const MappingType&,
- const AccessorType&)
- -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type,
- typename MappingType::layout_type, AccessorType>;
-}
-*/
-
-#ifndef _LIBCPP___CXX03_MDSPAN
-#define _LIBCPP___CXX03_MDSPAN
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__fwd/mdspan.h>
-# include <__cxx03/__mdspan/default_accessor.h>
-# include <__cxx03/__mdspan/extents.h>
-# include <__cxx03/__mdspan/layout_left.h>
-# include <__cxx03/__mdspan/layout_right.h>
-# include <__cxx03/__mdspan/layout_stride.h>
-# include <__cxx03/__mdspan/mdspan.h>
-#endif
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/array>
-# include <__cxx03/cinttypes>
-# include <__cxx03/concepts>
-# include <__cxx03/cstddef>
-# include <__cxx03/limits>
-# include <__cxx03/span>
-#endif
-
-#endif // _LIBCPP___CXX03_MDSPAN
diff --git a/libcxx/include/__cxx03/memory b/libcxx/include/__cxx03/memory
index ea417bb827c78..6e16a04275c6e 100644
--- a/libcxx/include/__cxx03/memory
+++ b/libcxx/include/__cxx03/memory
@@ -941,8 +941,6 @@ template<class Pointer = void, class Smart, class... Args>
#include <__cxx03/__memory/allocator_arg_t.h>
#include <__cxx03/__memory/allocator_traits.h>
#include <__cxx03/__memory/auto_ptr.h>
-#include <__cxx03/__memory/inout_ptr.h>
-#include <__cxx03/__memory/out_ptr.h>
#include <__cxx03/__memory/pointer_traits.h>
#include <__cxx03/__memory/raw_storage_iterator.h>
#include <__cxx03/__memory/shared_ptr.h>
@@ -959,10 +957,6 @@ template<class Pointer = void, class Smart, class... Args>
#if _LIBCPP_STD_VER >= 20
# include <__cxx03/__memory/assume_aligned.h>
-# include <__cxx03/__memory/concepts.h>
-# include <__cxx03/__memory/ranges_construct_at.h>
-# include <__cxx03/__memory/ranges_uninitialized_algorithms.h>
-# include <__cxx03/__memory/uses_allocator_construction.h>
#endif
#if _LIBCPP_STD_VER >= 23
@@ -971,16 +965,12 @@ template<class Pointer = void, class Smart, class... Args>
#include <__cxx03/version>
-// [memory.syn]
-#include <__cxx03/compare>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstddef>
# include <__cxx03/cstdint>
# include <__cxx03/cstdlib>
@@ -989,7 +979,6 @@ template<class Pointer = void, class Smart, class... Args>
# include <__cxx03/iterator>
# include <__cxx03/new>
# include <__cxx03/stdexcept>
-# include <__cxx03/tuple>
# include <__cxx03/type_traits>
# include <__cxx03/typeinfo>
# include <__cxx03/utility>
diff --git a/libcxx/include/__cxx03/memory_resource b/libcxx/include/__cxx03/memory_resource
deleted file mode 100644
index 1b56153dc843b..0000000000000
--- a/libcxx/include/__cxx03/memory_resource
+++ /dev/null
@@ -1,83 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_MEMORY_RESOURCE
-#define _LIBCPP___CXX03_MEMORY_RESOURCE
-
-/**
- memory_resource synopsis
-
-// C++17
-
-namespace std::pmr {
-
- class memory_resource;
-
- bool operator==(const memory_resource& a,
- const memory_resource& b) noexcept;
- bool operator!=(const memory_resource& a,
- const memory_resource& b) noexcept; // removed in C++20
-
- template <class Tp> class polymorphic_allocator;
-
- template <class T1, class T2>
- bool operator==(const polymorphic_allocator<T1>& a,
- const polymorphic_allocator<T2>& b) noexcept;
- template <class T1, class T2>
- bool operator!=(const polymorphic_allocator<T1>& a,
- const polymorphic_allocator<T2>& b) noexcept; // removed in C++20
-
- // Global memory resources
- memory_resource* set_default_resource(memory_resource* r) noexcept;
- memory_resource* get_default_resource() noexcept;
- memory_resource* new_delete_resource() noexcept;
- memory_resource* null_memory_resource() noexcept;
-
- // Pool resource classes
- struct pool_options;
- class synchronized_pool_resource;
- class unsynchronized_pool_resource;
- class monotonic_buffer_resource;
-
-} // namespace std::pmr
-
- */
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__memory_resource/memory_resource.h>
-# include <__cxx03/__memory_resource/monotonic_buffer_resource.h>
-# include <__cxx03/__memory_resource/polymorphic_allocator.h>
-# include <__cxx03/__memory_resource/pool_options.h>
-# include <__cxx03/__memory_resource/synchronized_pool_resource.h>
-# include <__cxx03/__memory_resource/unsynchronized_pool_resource.h>
-#endif
-
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
-# include <__cxx03/cstddef>
-# include <__cxx03/cstdint>
-# include <__cxx03/limits>
-# include <__cxx03/mutex>
-# include <__cxx03/new>
-# include <__cxx03/stdexcept>
-# include <__cxx03/tuple>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/stdexcept>
-#endif
-
-#endif /* _LIBCPP___CXX03_MEMORY_RESOURCE */
diff --git a/libcxx/include/__cxx03/mutex b/libcxx/include/__cxx03/mutex
index a799a0b774ad7..7879b9d7aadd1 100644
--- a/libcxx/include/__cxx03/mutex
+++ b/libcxx/include/__cxx03/mutex
@@ -500,11 +500,9 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
# include <__cxx03/ctime>
-# include <__cxx03/initializer_list>
# include <__cxx03/iosfwd>
# include <__cxx03/new>
# include <__cxx03/stdexcept>
diff --git a/libcxx/include/__cxx03/numbers b/libcxx/include/__cxx03/numbers
deleted file mode 100644
index 3ef8aa2324494..0000000000000
--- a/libcxx/include/__cxx03/numbers
+++ /dev/null
@@ -1,164 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_NUMBERS
-#define _LIBCPP___CXX03_NUMBERS
-
-/*
- numbers synopsis
-
-namespace std::numbers {
- template<class T> inline constexpr T e_v = unspecified;
- template<class T> inline constexpr T log2e_v = unspecified;
- template<class T> inline constexpr T log10e_v = unspecified;
- template<class T> inline constexpr T pi_v = unspecified;
- template<class T> inline constexpr T inv_pi_v = unspecified;
- template<class T> inline constexpr T inv_sqrtpi_v = unspecified;
- template<class T> inline constexpr T ln2_v = unspecified;
- template<class T> inline constexpr T ln10_v = unspecified;
- template<class T> inline constexpr T sqrt2_v = unspecified;
- template<class T> inline constexpr T sqrt3_v = unspecified;
- template<class T> inline constexpr T inv_sqrt3_v = unspecified;
- template<class T> inline constexpr T egamma_v = unspecified;
- template<class T> inline constexpr T phi_v = unspecified;
-
- template<floating_point T> inline constexpr T e_v<T> = see below;
- template<floating_point T> inline constexpr T log2e_v<T> = see below;
- template<floating_point T> inline constexpr T log10e_v<T> = see below;
- template<floating_point T> inline constexpr T pi_v<T> = see below;
- template<floating_point T> inline constexpr T inv_pi_v<T> = see below;
- template<floating_point T> inline constexpr T inv_sqrtpi_v<T> = see below;
- template<floating_point T> inline constexpr T ln2_v<T> = see below;
- template<floating_point T> inline constexpr T ln10_v<T> = see below;
- template<floating_point T> inline constexpr T sqrt2_v<T> = see below;
- template<floating_point T> inline constexpr T sqrt3_v<T> = see below;
- template<floating_point T> inline constexpr T inv_sqrt3_v<T> = see below;
- template<floating_point T> inline constexpr T egamma_v<T> = see below;
- template<floating_point T> inline constexpr T phi_v<T> = see below;
-
- inline constexpr double e = e_v<double>;
- inline constexpr double log2e = log2e_v<double>;
- inline constexpr double log10e = log10e_v<double>;
- inline constexpr double pi = pi_v<double>;
- inline constexpr double inv_pi = inv_pi_v<double>;
- inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
- inline constexpr double ln2 = ln2_v<double>;
- inline constexpr double ln10 = ln10_v<double>;
- inline constexpr double sqrt2 = sqrt2_v<double>;
- inline constexpr double sqrt3 = sqrt3_v<double>;
- inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>;
- inline constexpr double egamma = egamma_v<double>;
- inline constexpr double phi = phi_v<double>;
-}
-*/
-
-#include <__cxx03/__concepts/arithmetic.h>
-#include <__cxx03/__config>
-#include <__cxx03/version>
-
-#if _LIBCPP_STD_VER >= 20
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace numbers {
-
-template <class _Tp>
-inline constexpr bool __false = false;
-
-template <class _Tp>
-struct __illformed {
- static_assert(
- __false<_Tp>,
- "A program that instantiates a primary template of a mathematical constant variable template is ill-formed.");
-};
-
-template <class _Tp>
-inline constexpr _Tp e_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp log2e_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp log10e_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp pi_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp inv_pi_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp inv_sqrtpi_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp ln2_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp ln10_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp sqrt2_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp sqrt3_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp inv_sqrt3_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp egamma_v = __illformed<_Tp>{};
-template <class _Tp>
-inline constexpr _Tp phi_v = __illformed<_Tp>{};
-
-template <floating_point _Tp>
-inline constexpr _Tp e_v<_Tp> = 2.718281828459045235360287471352662;
-template <floating_point _Tp>
-inline constexpr _Tp log2e_v<_Tp> = 1.442695040888963407359924681001892;
-template <floating_point _Tp>
-inline constexpr _Tp log10e_v<_Tp> = 0.434294481903251827651128918916605;
-template <floating_point _Tp>
-inline constexpr _Tp pi_v<_Tp> = 3.141592653589793238462643383279502;
-template <floating_point _Tp>
-inline constexpr _Tp inv_pi_v<_Tp> = 0.318309886183790671537767526745028;
-template <floating_point _Tp>
-inline constexpr _Tp inv_sqrtpi_v<_Tp> = 0.564189583547756286948079451560772;
-template <floating_point _Tp>
-inline constexpr _Tp ln2_v<_Tp> = 0.693147180559945309417232121458176;
-template <floating_point _Tp>
-inline constexpr _Tp ln10_v<_Tp> = 2.302585092994045684017991454684364;
-template <floating_point _Tp>
-inline constexpr _Tp sqrt2_v<_Tp> = 1.414213562373095048801688724209698;
-template <floating_point _Tp>
-inline constexpr _Tp sqrt3_v<_Tp> = 1.732050807568877293527446341505872;
-template <floating_point _Tp>
-inline constexpr _Tp inv_sqrt3_v<_Tp> = 0.577350269189625764509148780501957;
-template <floating_point _Tp>
-inline constexpr _Tp egamma_v<_Tp> = 0.577215664901532860606512090082402;
-template <floating_point _Tp>
-inline constexpr _Tp phi_v<_Tp> = 1.618033988749894848204586834365638;
-
-inline constexpr double e = e_v<double>;
-inline constexpr double log2e = log2e_v<double>;
-inline constexpr double log10e = log10e_v<double>;
-inline constexpr double pi = pi_v<double>;
-inline constexpr double inv_pi = inv_pi_v<double>;
-inline constexpr double inv_sqrtpi = inv_sqrtpi_v<double>;
-inline constexpr double ln2 = ln2_v<double>;
-inline constexpr double ln10 = ln10_v<double>;
-inline constexpr double sqrt2 = sqrt2_v<double>;
-inline constexpr double sqrt3 = sqrt3_v<double>;
-inline constexpr double inv_sqrt3 = inv_sqrt3_v<double>;
-inline constexpr double egamma = egamma_v<double>;
-inline constexpr double phi = phi_v<double>;
-
-} // namespace numbers
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 20
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_NUMBERS
diff --git a/libcxx/include/__cxx03/numeric b/libcxx/include/__cxx03/numeric
index 992641b8c210b..d51d8d4e638a1 100644
--- a/libcxx/include/__cxx03/numeric
+++ b/libcxx/include/__cxx03/numeric
@@ -164,22 +164,6 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin
#include <__cxx03/__numeric/iota.h>
#include <__cxx03/__numeric/partial_sum.h>
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__numeric/exclusive_scan.h>
-# include <__cxx03/__numeric/gcd_lcm.h>
-# include <__cxx03/__numeric/inclusive_scan.h>
-# include <__cxx03/__numeric/pstl.h>
-# include <__cxx03/__numeric/reduce.h>
-# include <__cxx03/__numeric/transform_exclusive_scan.h>
-# include <__cxx03/__numeric/transform_inclusive_scan.h>
-# include <__cxx03/__numeric/transform_reduce.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__numeric/midpoint.h>
-# include <__cxx03/__numeric/saturation_arithmetic.h>
-#endif
-
#include <__cxx03/version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -187,20 +171,16 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
-# include <__cxx03/initializer_list>
# include <__cxx03/limits>
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/climits>
# include <__cxx03/cmath>
-# include <__cxx03/concepts>
# include <__cxx03/cstdint>
-# include <__cxx03/execution>
# include <__cxx03/functional>
# include <__cxx03/iterator>
# include <__cxx03/new>
-# include <__cxx03/optional>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/optional b/libcxx/include/__cxx03/optional
deleted file mode 100644
index e2c6fd0950c34..0000000000000
--- a/libcxx/include/__cxx03/optional
+++ /dev/null
@@ -1,1304 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_OPTIONAL
-#define _LIBCPP___CXX03_OPTIONAL
-
-/*
- optional synopsis
-
-// C++1z
-
-namespace std {
- // [optional.optional], class template optional
- template <class T>
- class optional;
-
- template<class T>
- concept is-derived-from-optional = requires(const T& t) { // exposition only
- []<class U>(const optional<U>&){ }(t);
- };
-
- // [optional.nullopt], no-value state indicator
- struct nullopt_t{see below };
- inline constexpr nullopt_t nullopt(unspecified );
-
- // [optional.bad.access], class bad_optional_access
- class bad_optional_access;
-
- // [optional.relops], relational operators
- template <class T, class U>
- constexpr bool operator==(const optional<T>&, const optional<U>&);
- template <class T, class U>
- constexpr bool operator!=(const optional<T>&, const optional<U>&);
- template <class T, class U>
- constexpr bool operator<(const optional<T>&, const optional<U>&);
- template <class T, class U>
- constexpr bool operator>(const optional<T>&, const optional<U>&);
- template <class T, class U>
- constexpr bool operator<=(const optional<T>&, const optional<U>&);
- template <class T, class U>
- constexpr bool operator>=(const optional<T>&, const optional<U>&);
- template<class T, three_way_comparable_with<T> U>
- constexpr compare_three_way_result_t<T, U>
- operator<=>(const optional<T>&, const optional<U>&); // since C++20
-
- // [optional.nullops], comparison with nullopt
- template<class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
- template<class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept; // until C++17
- template<class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept; // until C++17
- template<class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept; // until C++17
- template<class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept; // until C++17
- template<class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept; // until C++17
- template<class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept; // until C++17
- template<class T>
- constexpr strong_ordering operator<=>(const optional<T>&, nullopt_t) noexcept; // since C++20
-
- // [optional.comp.with.t], comparison with T
- template<class T, class U> constexpr bool operator==(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator==(const T&, const optional<U>&);
- template<class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator!=(const T&, const optional<U>&);
- template<class T, class U> constexpr bool operator<(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator<(const T&, const optional<U>&);
- template<class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator<=(const T&, const optional<U>&);
- template<class T, class U> constexpr bool operator>(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator>(const T&, const optional<U>&);
- template<class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
- template<class T, class U> constexpr bool operator>=(const T&, const optional<U>&);
- template<class T, class U>
- requires (!is-derived-from-optional<U>) && three_way_comparable_with<T, U>
- constexpr compare_three_way_result_t<T, U>
- operator<=>(const optional<T>&, const U&); // since C++20
-
- // [optional.specalg], specialized algorithms
- template<class T>
- void swap(optional<T>&, optional<T>&) noexcept(see below ); // constexpr in C++20
-
- template<class T>
- constexpr optional<see below > make_optional(T&&);
- template<class T, class... Args>
- constexpr optional<T> make_optional(Args&&... args);
- template<class T, class U, class... Args>
- constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
-
- // [optional.hash], hash support
- template<class T> struct hash;
- template<class T> struct hash<optional<T>>;
-
- template<class T>
- class optional {
- public:
- using value_type = T;
-
- // [optional.ctor], constructors
- constexpr optional() noexcept;
- constexpr optional(nullopt_t) noexcept;
- constexpr optional(const optional &);
- constexpr optional(optional &&) noexcept(see below);
- template<class... Args>
- constexpr explicit optional(in_place_t, Args &&...);
- template<class U, class... Args>
- constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...);
- template<class U = T>
- constexpr explicit(see-below) optional(U &&);
- template<class U>
- explicit(see-below) optional(const optional<U> &); // constexpr in C++20
- template<class U>
- explicit(see-below) optional(optional<U> &&); // constexpr in C++20
-
- // [optional.dtor], destructor
- ~optional(); // constexpr in C++20
-
- // [optional.assign], assignment
- optional &operator=(nullopt_t) noexcept; // constexpr in C++20
- constexpr optional &operator=(const optional &);
- constexpr optional &operator=(optional &&) noexcept(see below);
- template<class U = T> optional &operator=(U &&); // constexpr in C++20
- template<class U> optional &operator=(const optional<U> &); // constexpr in C++20
- template<class U> optional &operator=(optional<U> &&); // constexpr in C++20
- template<class... Args> T& emplace(Args &&...); // constexpr in C++20
- template<class U, class... Args> T& emplace(initializer_list<U>, Args &&...); // constexpr in C++20
-
- // [optional.swap], swap
- void swap(optional &) noexcept(see below ); // constexpr in C++20
-
- // [optional.observe], observers
- constexpr T const *operator->() const noexcept;
- constexpr T *operator->() noexcept;
- constexpr T const &operator*() const & noexcept;
- constexpr T &operator*() & noexcept;
- constexpr T &&operator*() && noexcept;
- constexpr const T &&operator*() const && noexcept;
- constexpr explicit operator bool() const noexcept;
- constexpr bool has_value() const noexcept;
- constexpr T const &value() const &;
- constexpr T &value() &;
- constexpr T &&value() &&;
- constexpr const T &&value() const &&;
- template<class U> constexpr T value_or(U &&) const &;
- template<class U> constexpr T value_or(U &&) &&;
-
- // [optional.monadic], monadic operations
- template<class F> constexpr auto and_then(F&& f) &; // since C++23
- template<class F> constexpr auto and_then(F&& f) &&; // since C++23
- template<class F> constexpr auto and_then(F&& f) const&; // since C++23
- template<class F> constexpr auto and_then(F&& f) const&&; // since C++23
- template<class F> constexpr auto transform(F&& f) &; // since C++23
- template<class F> constexpr auto transform(F&& f) &&; // since C++23
- template<class F> constexpr auto transform(F&& f) const&; // since C++23
- template<class F> constexpr auto transform(F&& f) const&&; // since C++23
- template<class F> constexpr optional or_else(F&& f) &&; // since C++23
- template<class F> constexpr optional or_else(F&& f) const&; // since C++23
-
- // [optional.mod], modifiers
- void reset() noexcept; // constexpr in C++20
-
- private:
- T *val; // exposition only
- };
-
- template<class T>
- optional(T) -> optional<T>;
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__assert>
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__concepts/invocable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__exception/exception.h>
-#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/unary_function.h>
-#include <__cxx03/__fwd/functional.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__tuple/sfinae_helpers.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/decay.h>
-#include <__cxx03/__type_traits/disjunction.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_assignable.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_destructible.h>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_object.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_scalar.h>
-#include <__cxx03/__type_traits/is_swappable.h>
-#include <__cxx03/__type_traits/is_trivially_assignable.h>
-#include <__cxx03/__type_traits/is_trivially_constructible.h>
-#include <__cxx03/__type_traits/is_trivially_destructible.h>
-#include <__cxx03/__type_traits/is_trivially_relocatable.h>
-#include <__cxx03/__type_traits/negation.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/initializer_list>
-#include <__cxx03/new>
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [optional.syn]
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-namespace std // purposefully not using versioning namespace
-{
-
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access : public exception {
-public:
- _LIBCPP_HIDE_FROM_ABI bad_optional_access() _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access(const bad_optional_access&) _NOEXCEPT = default;
- _LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
- // Get the key function ~bad_optional_access() into the dylib
- ~bad_optional_access() _NOEXCEPT override;
- const char* what() const _NOEXCEPT override;
-};
-
-} // namespace std
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
-__throw_bad_optional_access() {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_optional_access();
-# else
- _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");
-# endif
-}
-
-struct nullopt_t {
- struct __secret_tag {
- explicit __secret_tag() = default;
- };
- _LIBCPP_HIDE_FROM_ABI constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
-};
-
-inline constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
-
-struct __optional_construct_from_invoke_tag {};
-
-template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
-struct __optional_destruct_base;
-
-template <class _Tp>
-struct __optional_destruct_base<_Tp, false> {
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
- union {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__optional_destruct_base() {
- if (__engaged_)
- __val_.~value_type();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-
-# if _LIBCPP_STD_VER >= 23
- template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(
- __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
- : __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-# endif
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
- if (__engaged_) {
- __val_.~value_type();
- __engaged_ = false;
- }
- }
-};
-
-template <class _Tp>
-struct __optional_destruct_base<_Tp, true> {
- typedef _Tp value_type;
- static_assert(is_object_v<value_type>, "instantiation of optional with a non-object type is undefined behavior");
- union {
- char __null_state_;
- value_type __val_;
- };
- bool __engaged_;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...), __engaged_(true) {}
-
-# if _LIBCPP_STD_VER >= 23
- template <class _Fp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(
- __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args)
- : __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {}
-# endif
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept {
- if (__engaged_) {
- __engaged_ = false;
- }
- }
-};
-
-template <class _Tp, bool = is_reference<_Tp>::value>
-struct __optional_storage_base : __optional_destruct_base<_Tp> {
- using __base = __optional_destruct_base<_Tp>;
- using value_type = _Tp;
- using __base::__base;
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() & noexcept { return this->__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr const value_type& __get() const& noexcept { return this->__val_; }
- _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() && noexcept { return std::move(this->__val_); }
- _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& __get() const&& noexcept { return std::move(this->__val_); }
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- std::__construct_at(std::addressof(this->__val_), std::forward<_Args>(__args)...);
- this->__engaged_ = true;
- }
-
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
-
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
- if (this->__engaged_ == __opt.has_value()) {
- if (this->__engaged_)
- this->__val_ = std::forward<_That>(__opt).__get();
- } else {
- if (this->__engaged_)
- this->reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
- }
-};
-
-// optional<T&> is currently required to be ill-formed. However, it may
-// be allowed in the future. For this reason, it has already been implemented
-// to ensure we can make the change in an ABI-compatible manner.
-template <class _Tp>
-struct __optional_storage_base<_Tp, true> {
- using value_type = _Tp;
- using __raw_type = remove_reference_t<_Tp>;
- __raw_type* __value_;
-
- template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
- using _RawUp = __libcpp_remove_reference_t<_Up>;
- using _UpPtr = _RawUp*;
- using _RawTp = __libcpp_remove_reference_t<_Tp>;
- using _TpPtr = _RawTp*;
- using _CheckLValueArg =
- integral_constant<bool,
- (is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) ||
- is_same<_RawUp, reference_wrapper<_RawTp>>::value ||
- is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >;
- return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) ||
- (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
- is_convertible<_UpPtr, _TpPtr>::value);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
- : __value_(std::addressof(__uarg)) {
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const& noexcept { return *__value_; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type&& __get() const&& noexcept { return std::forward<value_type>(*__value_); }
-
- template <class _UArg>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
- _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
- static_assert(__can_bind_reference<_UArg>(),
- "Attempted to construct a reference element in tuple from a "
- "possible temporary");
- __value_ = std::addressof(__val);
- }
-
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct_from(_That&& __opt) {
- if (__opt.has_value())
- __construct(std::forward<_That>(__opt).__get());
- }
-
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_from(_That&& __opt) {
- if (has_value() == __opt.has_value()) {
- if (has_value())
- *__value_ = std::forward<_That>(__opt).__get();
- } else {
- if (has_value())
- reset();
- else
- __construct(std::forward<_That>(__opt).__get());
- }
- }
-};
-
-template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
-struct __optional_copy_base : __optional_storage_base<_Tp> {
- using __optional_storage_base<_Tp>::__optional_storage_base;
-};
-
-template <class _Tp>
-struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
- using __optional_storage_base<_Tp>::__optional_storage_base;
-
- _LIBCPP_HIDE_FROM_ABI __optional_copy_base() = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_base(const __optional_copy_base& __opt) {
- this->__construct_from(__opt);
- }
-
- _LIBCPP_HIDE_FROM_ABI __optional_copy_base(__optional_copy_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(const __optional_copy_base&) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
-};
-
-template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
-struct __optional_move_base : __optional_copy_base<_Tp> {
- using __optional_copy_base<_Tp>::__optional_copy_base;
-};
-
-template <class _Tp>
-struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
- using value_type = _Tp;
- using __optional_copy_base<_Tp>::__optional_copy_base;
-
- _LIBCPP_HIDE_FROM_ABI __optional_move_base() = default;
- _LIBCPP_HIDE_FROM_ABI __optional_move_base(const __optional_move_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __optional_move_base(__optional_move_base&& __opt) noexcept(is_nothrow_move_constructible_v<value_type>) {
- this->__construct_from(std::move(__opt));
- }
-
- _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(const __optional_move_base&) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_move_base& operator=(__optional_move_base&&) = default;
-};
-
-template <class _Tp,
- bool = is_trivially_destructible<_Tp>::value && is_trivially_copy_constructible<_Tp>::value &&
- is_trivially_copy_assignable<_Tp>::value>
-struct __optional_copy_assign_base : __optional_move_base<_Tp> {
- using __optional_move_base<_Tp>::__optional_move_base;
-};
-
-template <class _Tp>
-struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
- using __optional_move_base<_Tp>::__optional_move_base;
-
- _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_copy_assign_base&
- operator=(const __optional_copy_assign_base& __opt) {
- this->__assign_from(__opt);
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
-};
-
-template <class _Tp,
- bool = is_trivially_destructible<_Tp>::value && is_trivially_move_constructible<_Tp>::value &&
- is_trivially_move_assignable<_Tp>::value>
-struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
-};
-
-template <class _Tp>
-struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp> {
- using value_type = _Tp;
- using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
-
- _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base() = default;
- _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base(__optional_move_assign_base&&) = default;
- _LIBCPP_HIDE_FROM_ABI __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __optional_move_assign_base&
- operator=(__optional_move_assign_base&& __opt) noexcept(
- is_nothrow_move_assignable_v<value_type> && is_nothrow_move_constructible_v<value_type>) {
- this->__assign_from(std::move(__opt));
- return *this;
- }
-};
-
-template <class _Tp>
-using __optional_sfinae_ctor_base_t =
- __sfinae_ctor_base< is_copy_constructible<_Tp>::value, is_move_constructible<_Tp>::value >;
-
-template <class _Tp>
-using __optional_sfinae_assign_base_t =
- __sfinae_assign_base< (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value),
- (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value) >;
-
-template <class _Tp>
-class optional;
-
-# if _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
-
-# endif // _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-struct __is_std_optional : false_type {};
-template <class _Tp>
-struct __is_std_optional<optional<_Tp>> : true_type {};
-
-template <class _Tp>
-class _LIBCPP_DECLSPEC_EMPTY_BASES optional
- : private __optional_move_assign_base<_Tp>,
- private __optional_sfinae_ctor_base_t<_Tp>,
- private __optional_sfinae_assign_base_t<_Tp> {
- using __base = __optional_move_assign_base<_Tp>;
-
-public:
- using value_type = _Tp;
-
- using __trivially_relocatable = conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>;
-
-private:
- // Disable the reference extension using this static assert.
- static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
- "instantiation of optional with in_place_t is ill-formed");
- static_assert(!is_same_v<__remove_cvref_t<value_type>, nullopt_t>,
- "instantiation of optional with nullopt_t is ill-formed");
- static_assert(!is_reference_v<value_type>, "instantiation of optional with a reference type is ill-formed");
- static_assert(is_destructible_v<value_type>, "instantiation of optional with a non-destructible type is ill-formed");
- static_assert(!is_array_v<value_type>, "instantiation of optional with an array type is ill-formed");
-
- // LWG2756: conditionally explicit conversion from _Up
- struct _CheckOptionalArgsConstructor {
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_constructible_v<_Tp, _Up&&> && is_convertible_v<_Up&&, _Tp>;
- }
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return is_constructible_v<_Tp, _Up&&> && !is_convertible_v<_Up&&, _Tp>;
- }
- };
- template <class _Up>
- using _CheckOptionalArgsCtor =
- _If< _IsNotSame<__remove_cvref_t<_Up>, in_place_t>::value && _IsNotSame<__remove_cvref_t<_Up>, optional>::value &&
- (!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_optional<__remove_cvref_t<_Up>>::value),
- _CheckOptionalArgsConstructor,
- __check_tuple_constructor_fail >;
- template <class _QualUp>
- struct _CheckOptionalLikeConstructor {
- template <class _Up, class _Opt = optional<_Up>>
- using __check_constructible_from_opt =
- _Or< is_constructible<_Tp, _Opt&>,
- is_constructible<_Tp, _Opt const&>,
- is_constructible<_Tp, _Opt&&>,
- is_constructible<_Tp, _Opt const&&>,
- is_convertible<_Opt&, _Tp>,
- is_convertible<_Opt const&, _Tp>,
- is_convertible<_Opt&&, _Tp>,
- is_convertible<_Opt const&&, _Tp> >;
- template <class _Up, class _Opt = optional<_Up>>
- using __check_assignable_from_opt =
- _Or< is_assignable<_Tp&, _Opt&>,
- is_assignable<_Tp&, _Opt const&>,
- is_assignable<_Tp&, _Opt&&>,
- is_assignable<_Tp&, _Opt const&&> >;
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_implicit() {
- return is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_explicit() {
- return !is_convertible<_QUp, _Tp>::value &&
- (is_same_v<remove_cv_t<_Tp>, bool> || !__check_constructible_from_opt<_Up>::value);
- }
- template <class _Up, class _QUp = _QualUp>
- _LIBCPP_HIDE_FROM_ABI static constexpr bool __enable_assign() {
- // Construction and assignability of _QUp to _Tp has already been
- // checked.
- return !__check_constructible_from_opt<_Up>::value && !__check_assignable_from_opt<_Up>::value;
- }
- };
-
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeCtor =
- _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp> >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail >;
- template <class _Up, class _QualUp>
- using _CheckOptionalLikeAssign =
- _If< _And< _IsNotSame<_Up, _Tp>, is_constructible<_Tp, _QualUp>, is_assignable<_Tp&, _QualUp> >::value,
- _CheckOptionalLikeConstructor<_QualUp>,
- __check_tuple_constructor_fail >;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr optional() noexcept {}
- _LIBCPP_HIDE_FROM_ABI constexpr optional(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
-
- template <
- class _InPlaceT,
- class... _Args,
- class = enable_if_t< _And< _IsSame<_InPlaceT, in_place_t>, is_constructible<value_type, _Args...> >::value > >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
- : __base(in_place, std::forward<_Args>(__args)...) {}
-
- template <class _Up,
- class... _Args,
- class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...>> >
- _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
- : __base(in_place, __il, std::forward<_Args>(__args)...) {}
-
- template <class _Up = value_type,
- enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
-
- template <class _Up, enable_if_t< _CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) : __base(in_place, std::forward<_Up>(__v)) {}
-
- // LWG2756: conditionally explicit conversion from const optional<_Up>&
- template <class _Up,
- enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) {
- this->__construct_from(__v);
- }
- template <class _Up,
- enable_if_t< _CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) {
- this->__construct_from(__v);
- }
-
- // LWG2756: conditionally explicit conversion from optional<_Up>&&
- template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) {
- this->__construct_from(std::move(__v));
- }
- template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) {
- this->__construct_from(std::move(__v));
- }
-
-# if _LIBCPP_STD_VER >= 23
- template <class _Tag,
- class _Fp,
- class... _Args,
- __enable_if_t<_IsSame<_Tag, __optional_construct_from_invoke_tag>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Tag, _Fp&& __f, _Args&&... __args)
- : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {}
-# endif
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(nullopt_t) noexcept {
- reset();
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(const optional&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
-
- // LWG2756
- template <
- class _Up = value_type,
- class = enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Up>, optional>,
- _Or< _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >,
- is_constructible<value_type, _Up>,
- is_assignable<value_type&, _Up> >::value> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
- if (this->has_value())
- this->__get() = std::forward<_Up>(__v);
- else
- this->__construct(std::forward<_Up>(__v));
- return *this;
- }
-
- // LWG2756
- template <class _Up,
- enable_if_t< _CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(const optional<_Up>& __v) {
- this->__assign_from(__v);
- return *this;
- }
-
- // LWG2756
- template <class _Up, enable_if_t< _CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_assign<_Up>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(optional<_Up>&& __v) {
- this->__assign_from(std::move(__v));
- return *this;
- }
-
- template <class... _Args, class = enable_if_t< is_constructible_v<value_type, _Args...> > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
- reset();
- this->__construct(std::forward<_Args>(__args)...);
- return this->__get();
- }
-
- template <class _Up,
- class... _Args,
- class = enable_if_t< is_constructible_v<value_type, initializer_list<_Up>&, _Args...> > >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
- reset();
- this->__construct(__il, std::forward<_Args>(__args)...);
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
- swap(optional& __opt) noexcept(is_nothrow_move_constructible_v<value_type> && is_nothrow_swappable_v<value_type>) {
- if (this->has_value() == __opt.has_value()) {
- using std::swap;
- if (this->has_value())
- swap(this->__get(), __opt.__get());
- } else {
- if (this->has_value()) {
- __opt.__construct(std::move(this->__get()));
- reset();
- } else {
- this->__construct(std::move(__opt.__get()));
- __opt.reset();
- }
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type const> operator->() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<value_type> operator->() noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
- return std::addressof(this->__get());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const value_type& operator*() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type& operator*() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr value_type&& operator*() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const value_type&& operator*() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
- return std::move(this->__get());
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); }
-
- using __base::__get;
- using __base::has_value;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const& {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
- if (!this->has_value())
- __throw_bad_optional_access();
- return this->__get();
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type&& value() && {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const&& value() const&& {
- if (!this->has_value())
- __throw_bad_optional_access();
- return std::move(this->__get());
- }
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) const& {
- static_assert(is_copy_constructible_v<value_type>, "optional<T>::value_or: T must be copy constructible");
- static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? this->__get() : static_cast<value_type>(std::forward<_Up>(__v));
- }
-
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr value_type value_or(_Up&& __v) && {
- static_assert(is_move_constructible_v<value_type>, "optional<T>::value_or: T must be move constructible");
- static_assert(is_convertible_v<_Up, value_type>, "optional<T>::value_or: U must be convertible to T");
- return this->has_value() ? std::move(this->__get()) : static_cast<value_type>(std::forward<_Up>(__v));
- }
-
-# if _LIBCPP_STD_VER >= 23
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) & {
- using _Up = invoke_result_t<_Func, value_type&>;
- static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
- "Result of f(value()) must be a specialization of std::optional");
- if (*this)
- return std::invoke(std::forward<_Func>(__f), value());
- return remove_cvref_t<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) const& {
- using _Up = invoke_result_t<_Func, const value_type&>;
- static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
- "Result of f(value()) must be a specialization of std::optional");
- if (*this)
- return std::invoke(std::forward<_Func>(__f), value());
- return remove_cvref_t<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) && {
- using _Up = invoke_result_t<_Func, value_type&&>;
- static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
- "Result of f(std::move(value())) must be a specialization of std::optional");
- if (*this)
- return std::invoke(std::forward<_Func>(__f), std::move(value()));
- return remove_cvref_t<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
- using _Up = invoke_result_t<_Func, const value_type&&>;
- static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
- "Result of f(std::move(value())) must be a specialization of std::optional");
- if (*this)
- return std::invoke(std::forward<_Func>(__f), std::move(value()));
- return remove_cvref_t<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) & {
- using _Up = remove_cv_t<invoke_result_t<_Func, value_type&>>;
- static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
- static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
- if (*this)
- return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
- return optional<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const& {
- using _Up = remove_cv_t<invoke_result_t<_Func, const value_type&>>;
- static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
- static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
- if (*this)
- return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
- return optional<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) && {
- using _Up = remove_cv_t<invoke_result_t<_Func, value_type&&>>;
- static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
- static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
- if (*this)
- return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
- return optional<_Up>();
- }
-
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto transform(_Func&& __f) const&& {
- using _Up = remove_cvref_t<invoke_result_t<_Func, const value_type&&>>;
- static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
- static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
- static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
- static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
- if (*this)
- return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
- return optional<_Up>();
- }
-
- template <invocable _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
- requires is_copy_constructible_v<value_type>
- {
- static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
- "Result of f() should be the same type as this optional");
- if (*this)
- return *this;
- return std::forward<_Func>(__f)();
- }
-
- template <invocable _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
- requires is_move_constructible_v<value_type>
- {
- static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
- "Result of f() should be the same type as this optional");
- if (*this)
- return std::move(*this);
- return std::forward<_Func>(__f)();
- }
-# endif // _LIBCPP_STD_VER >= 23
-
- using __base::reset;
-};
-
-# if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-optional(_Tp) -> optional<_Tp>;
-# endif
-
-// Comparisons between optionals
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
- bool >
-operator==(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x == *__y;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
- bool >
-operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (static_cast<bool>(__x) != static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x != *__y;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
- bool >
-operator<(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (!static_cast<bool>(__y))
- return false;
- if (!static_cast<bool>(__x))
- return true;
- return *__x < *__y;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
- bool >
-operator>(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (!static_cast<bool>(__x))
- return false;
- if (!static_cast<bool>(__y))
- return true;
- return *__x > *__y;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
- bool >
-operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (!static_cast<bool>(__x))
- return true;
- if (!static_cast<bool>(__y))
- return false;
- return *__x <= *__y;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
- bool >
-operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (!static_cast<bool>(__y))
- return true;
- if (!static_cast<bool>(__x))
- return false;
- return *__x >= *__y;
-}
-
-# if _LIBCPP_STD_VER >= 20
-
-template <class _Tp, three_way_comparable_with<_Tp> _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
-operator<=>(const optional<_Tp>& __x, const optional<_Up>& __y) {
- if (__x && __y)
- return *__x <=> *__y;
- return __x.has_value() <=> __y.has_value();
-}
-
-# endif // _LIBCPP_STD_VER >= 20
-
-// Comparisons with nullopt
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const optional<_Tp>& __x, nullopt_t) noexcept {
- return !static_cast<bool>(__x);
-}
-
-# if _LIBCPP_STD_VER <= 17
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(nullopt_t, const optional<_Tp>& __x) noexcept {
- return !static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const optional<_Tp>& __x, nullopt_t) noexcept {
- return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(nullopt_t, const optional<_Tp>& __x) noexcept {
- return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const optional<_Tp>&, nullopt_t) noexcept {
- return false;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(nullopt_t, const optional<_Tp>& __x) noexcept {
- return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const optional<_Tp>& __x, nullopt_t) noexcept {
- return !static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(nullopt_t, const optional<_Tp>&) noexcept {
- return true;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const optional<_Tp>& __x, nullopt_t) noexcept {
- return static_cast<bool>(__x);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(nullopt_t, const optional<_Tp>&) noexcept {
- return false;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const optional<_Tp>&, nullopt_t) noexcept {
- return true;
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(nullopt_t, const optional<_Tp>& __x) noexcept {
- return !static_cast<bool>(__x);
-}
-
-# else // _LIBCPP_STD_VER <= 17
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const optional<_Tp>& __x, nullopt_t) noexcept {
- return __x.has_value() <=> false;
-}
-
-# endif // _LIBCPP_STD_VER <= 17
-
-// Comparisons with T
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
- bool >
-operator==(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x == __v : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
- bool >
-operator==(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v == *__x : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
- bool >
-operator!=(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x != __v : true;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
- bool >
-operator!=(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v != *__x : true;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
- bool >
-operator<(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x < __v : true;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
- bool >
-operator<(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v < *__x : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
- bool >
-operator<=(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x <= __v : true;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
- bool >
-operator<=(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v <= *__x : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
- bool >
-operator>(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x > __v : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
- bool >
-operator>(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v > *__x : true;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
- bool >
-operator>=(const optional<_Tp>& __x, const _Up& __v) {
- return static_cast<bool>(__x) ? *__x >= __v : false;
-}
-
-template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<
- is_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
- bool >
-operator>=(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v >= *__x : true;
-}
-
-# if _LIBCPP_STD_VER >= 20
-
-template <class _Tp, class _Up>
- requires(!__is_derived_from_optional<_Up>) && three_way_comparable_with<_Tp, _Up>
-_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Tp, _Up>
-operator<=>(const optional<_Tp>& __x, const _Up& __v) {
- return __x.has_value() ? *__x <=> __v : strong_ordering::less;
-}
-
-# endif // _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI
-_LIBCPP_CONSTEXPR_SINCE_CXX20 enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
-swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
- __x.swap(__y);
-}
-
-template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
- return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
-}
-
-template <class _Tp, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
- return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
-}
-
-template <class _Tp, class _Up, class... _Args>
-_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args) {
- return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
-}
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>> > {
-# if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
- _LIBCPP_DEPRECATED_IN_CXX17 typedef optional<_Tp> argument_type;
- _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
-# endif
-
- _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
- return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
- }
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-# include <__cxx03/climits>
-# include <__cxx03/concepts>
-# include <__cxx03/ctime>
-# include <__cxx03/iterator>
-# include <__cxx03/limits>
-# include <__cxx03/memory>
-# include <__cxx03/ratio>
-# include <__cxx03/stdexcept>
-# include <__cxx03/tuple>
-# include <__cxx03/type_traits>
-# include <__cxx03/typeinfo>
-# include <__cxx03/utility>
-# include <__cxx03/variant>
-#endif
-
-#endif // _LIBCPP___CXX03_OPTIONAL
diff --git a/libcxx/include/__cxx03/ostream b/libcxx/include/__cxx03/ostream
index 4400fa60ba7e7..abb5ce8690273 100644
--- a/libcxx/include/__cxx03/ostream
+++ b/libcxx/include/__cxx03/ostream
@@ -188,13 +188,10 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdio>
# include <__cxx03/cstdlib>
-# include <__cxx03/format>
# include <__cxx03/iosfwd>
# include <__cxx03/iterator>
-# include <__cxx03/print>
# include <__cxx03/stdexcept>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/print b/libcxx/include/__cxx03/print
deleted file mode 100644
index 02f1a6127a21a..0000000000000
--- a/libcxx/include/__cxx03/print
+++ /dev/null
@@ -1,402 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_PRINT
-#define _LIBCPP___CXX03_PRINT
-
-/*
-namespace std {
- // [print.fun], print functions
- template<class... Args>
- void print(format_string<Args...> fmt, Args&&... args);
- void println(); // Since C++26
- template<class... Args>
- void print(FILE* stream, format_string<Args...> fmt, Args&&... args);
- void println(FILE* stream); // Since C++26
-
- template<class... Args>
- void println(format_string<Args...> fmt, Args&&... args);
- template<class... Args>
- void println(FILE* stream, format_string<Args...> fmt, Args&&... args);
-
- void vprint_unicode(string_view fmt, format_args args);
- void vprint_unicode(FILE* stream, string_view fmt, format_args args);
-
- void vprint_nonunicode(string_view fmt, format_args args);
- void vprint_nonunicode(FILE* stream, string_view fmt, format_args args);
-}
-*/
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/same_as.h>
-#include <__cxx03/__config>
-#include <__cxx03/__system_error/system_error.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/cerrno>
-#include <__cxx03/cstdio>
-#include <__cxx03/format>
-#include <__cxx03/string>
-#include <__cxx03/string_view>
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#ifdef _LIBCPP_WIN32API
-_LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-// A wrapper for WriteConsoleW which is used to write to the Windows
-// console. This function is in the dylib to avoid pulling in windows.h
-// in the library headers. The function itself uses some private parts
-// of the dylib too.
-//
-// The function does not depend on the language standard used. Guarding
-// it with C++23 would fail since the dylib is currently built using C++20.
-//
-// Note the function is only implemented on the Windows platform.
-_LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-#elif __has_include(<unistd.h>)
-_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream);
-#endif // _LIBCPP_WIN32API
-
-#if _LIBCPP_STD_VER >= 23
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-// This is the code to transcode UTF-8 to UTF-16. This is used on
-// Windows for the native Unicode API. The code is modeled to make it
-// easier to extend to
-//
-// P2728R0 Unicode in the Library, Part 1: UTF Transcoding
-//
-// This paper is still under heavy development so it makes no sense yet
-// to strictly follow the paper.
-namespace __unicode {
-
-// The names of these concepts are modelled after P2728R0, but the
-// implementation is not. char16_t may contain 32-bits so depending on the
-// number of bits is an issue.
-# ifdef _LIBCPP_SHORT_WCHAR
-template <class _Tp>
-concept __utf16_code_unit =
- same_as<_Tp, char16_t>
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- || same_as<_Tp, wchar_t>
-# endif
- ;
-template <class _Tp>
-concept __utf32_code_unit = same_as<_Tp, char32_t>;
-# else // _LIBCPP_SHORT_WCHAR
-template <class _Tp>
-concept __utf16_code_unit = same_as<_Tp, char16_t>;
-template <class _Tp>
-concept __utf32_code_unit =
- same_as<_Tp, char32_t>
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- || same_as<_Tp, wchar_t>
-# endif
- ;
-# endif // _LIBCPP_SHORT_WCHAR
-
-// Pass by reference since an output_iterator may not be copyable.
-template <class _OutIt>
-_LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt&, char32_t) = delete;
-
-template <class _OutIt>
- requires __utf16_code_unit<iter_value_t<_OutIt>>
-_LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt& __out_it, char32_t __value) {
- // [print.fun]/7 : "if `out` contains invalid code units, the behavior is undefined and implementations are encouraged
- // to diagnose it".
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_scalar_value(__value), "an invalid unicode scalar value results in invalid UTF-16");
-
- if (__value < 0x10000) {
- *__out_it++ = __value;
- return;
- }
-
- __value -= 0x10000;
- *__out_it++ = 0xd800 + (__value >> 10);
- *__out_it++ = 0xdc00 + (__value & 0x3FF);
-}
-
-template <class _OutIt>
- requires __utf32_code_unit<iter_value_t<_OutIt>>
-_LIBCPP_HIDE_FROM_ABI constexpr void __encode(_OutIt& __out_it, char32_t __value) {
- // [print.fun]/7 : "if `out` contains invalid code units, the behavior is undefined and implementations are encouraged
- // to diagnose it".
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_scalar_value(__value), "an invalid unicode scalar value results in invalid UTF-32");
- *__out_it++ = __value;
-}
-
-template <class _OutIt, input_iterator _InIt>
- requires output_iterator<_OutIt, const iter_value_t<_OutIt>&> && (!same_as<iter_value_t<_OutIt>, iter_value_t<_InIt>>)
-_LIBCPP_HIDE_FROM_ABI constexpr _OutIt __transcode(_InIt __first, _InIt __last, _OutIt __out_it) {
- // The __code_point_view has a basic_string_view interface.
- // When transcoding becomes part of the standard we probably want to
- // look at smarter algorithms.
- // For example, when processing a code point that is encoded in
- // 1 to 3 code units in UTF-8, the result will always be encoded
- // in 1 code unit in UTF-16 (code points that require 4 code
- // units in UTF-8 will require 2 code units in UTF-16).
- //
- // Note if P2728 is accepted types like int may become valid. In that case
- // the __code_point_view should use a span. Libc++ will remove support for
- // char_traits<int>.
-
- // TODO PRINT Validate with clang-tidy
- // NOLINTNEXTLINE(bugprone-dangling-handle)
- basic_string_view<iter_value_t<_InIt>> __data{__first, __last};
- __code_point_view<iter_value_t<_InIt>> __view{__data.begin(), __data.end()};
- while (!__view.__at_end())
- __unicode::__encode(__out_it, __view.__consume().__code_point);
- return __out_it;
-}
-
-} // namespace __unicode
-
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-namespace __print {
-
-// [print.fun]/2
-// Effects: If the ordinary literal encoding ([lex.charset]) is UTF-8, equivalent to:
-// vprint_unicode(stream, fmt.str, make_format_args(args...));
-// Otherwise, equivalent to:
-// vprint_nonunicode(stream, fmt.str, make_format_args(args...));
-//
-// Based on the compiler and its compilation flags this value is or is
-// not true. As mentioned in P2093R14 this only affects Windows. The
-// test below could also be done for
-// - GCC using __GNUC_EXECUTION_CHARSET_NAME
-// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
-// - Clang using __clang_literal_encoding__
-// https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
-// (note at the time of writing Clang is hard-coded to UTF-8.)
-//
-
-# ifdef _LIBCPP_HAS_NO_UNICODE
-inline constexpr bool __use_unicode_execution_charset = false;
-# elif defined(_MSVC_EXECUTION_CHARACTER_SET)
-// This is the same test MSVC STL uses in their implementation of <print>
-// See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
-inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTER_SET == 65001;
-# else
-inline constexpr bool __use_unicode_execution_charset = true;
-# endif
-
-_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) {
- // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
- // the behavior in the test. This is not part of the public API.
-# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
- return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
-# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0
- return false;
-# elif defined(_LIBCPP_WIN32API)
- return std::__is_windows_terminal(__stream);
-# elif __has_include(<unistd.h>)
- return std::__is_posix_terminal(__stream);
-# else
-# error "Provide a way to determine whether a FILE* is a terminal"
-# endif
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl) {
- _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream");
- string __str = std::vformat(__fmt, __args);
- if (__write_nl)
- __str.push_back('\n');
-
- size_t __size = fwrite(__str.data(), 1, __str.size(), __stream);
- if (__size < __str.size()) {
- if (std::feof(__stream))
- std::__throw_system_error(EIO, "EOF while writing the formatted output");
- std::__throw_system_error(std::ferror(__stream), "failed to write formatted output");
- }
-}
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-
-// Note these helper functions are mainly used to aid testing.
-// On POSIX systems and Windows the output is no longer considered a
-// terminal when the output is redirected. Typically during testing the
-// output is redirected to be able to capture it. This makes it hard to
-// test this code path.
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_unicode_posix(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
- // TODO PRINT Should flush errors throw too?
- if (__is_terminal)
- std::fflush(__stream);
-
- __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
-}
-
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
- if (!__is_terminal)
- return __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
-
- // TODO PRINT Should flush errors throw too?
- std::fflush(__stream);
-
- string __str = std::vformat(__fmt, __args);
- // UTF-16 uses the same number or less code units than UTF-8.
- // However the size of the code unit is 16 bits instead of 8 bits.
- //
- // The buffer uses the worst-case estimate and should never resize.
- // However when the string is large this could lead to OOM. Using a
- // smaller size might work, but since the buffer uses a grow factor
- // the final size might be larger when the estimate is wrong.
- //
- // TODO PRINT profile and improve the speed of this code.
- __format::__retarget_buffer<wchar_t> __buffer{__str.size()};
- __unicode::__transcode(__str.begin(), __str.end(), __buffer.__make_output_iterator());
- if (__write_nl)
- __buffer.push_back(L'\n');
-
- [[maybe_unused]] wstring_view __view = __buffer.__view();
-
- // The macro _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION is used to change
- // the behavior in the test. This is not part of the public API.
-# ifdef _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION
- _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION(__stream, __view);
-# elif defined(_LIBCPP_WIN32API)
- std::__write_to_windows_console(__stream, __view);
-# else
- std::__throw_runtime_error("No defintion of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION and "
- "__write_to_windows_console is not available.");
-# endif
-}
-# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_unicode([[maybe_unused]] FILE* __stream,
- [[maybe_unused]] string_view __fmt,
- [[maybe_unused]] format_args __args,
- [[maybe_unused]] bool __write_nl) {
- _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream");
-
- // [print.fun]
- // 7 - Effects: If stream refers to a terminal capable of displaying
- // Unicode, writes out to the terminal using the native Unicode
- // API; if out contains invalid code units, the behavior is
- // undefined and implementations are encouraged to diagnose it.
- // Otherwise writes out to stream unchanged. If the native
- // Unicode API is used, the function flushes stream before
- // writing out.
- // 8 - Throws: Any exception thrown by the call to vformat
- // ([format.err.report]). system_error if writing to the terminal
- // or stream fails. May throw bad_alloc.
- // 9 - Recommended practice: If invoking the native Unicode API
- // requires transcoding, implementations should substitute
- // invalid code units with U+FFFD replacement character per the
- // Unicode Standard, Chapter 3.9 U+FFFD Substitution in
- // Conversion.
-
- // On non-Windows platforms the Unicode API is the normal file I/O API
- // so there the call can be forwarded to the non_unicode API. On
- // Windows there is a different API. This API requires transcoding.
-
-# ifndef _LIBCPP_WIN32API
- __print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
-# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
- __print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
-# else
-# error "Windows builds with wchar_t disabled are not supported."
-# endif
-}
-
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-} // namespace __print
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
-# ifndef _LIBCPP_HAS_NO_UNICODE
- if constexpr (__print::__use_unicode_execution_charset)
- __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
- else
- __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
-# else // _LIBCPP_HAS_NO_UNICODE
- __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
-# endif // _LIBCPP_HAS_NO_UNICODE
-}
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __args) {
- std::print(stdout, __fmt, std::forward<_Args>(__args)...);
-}
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
-# ifndef _LIBCPP_HAS_NO_UNICODE
- // Note the wording in the Standard is inefficient. The output of
- // std::format is a std::string which is then copied. This solution
- // just appends a newline at the end of the output.
- if constexpr (__print::__use_unicode_execution_charset)
- __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
- else
- __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
-# else // _LIBCPP_HAS_NO_UNICODE
- __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
-# endif // _LIBCPP_HAS_NO_UNICODE
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void println(FILE* __stream) {
- std::print(__stream, "\n");
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void println() {
- println(stdout);
-}
-
-template <class... _Args>
-_LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __args) {
- std::println(stdout, __fmt, std::forward<_Args>(__args)...);
-}
-
-# ifndef _LIBCPP_HAS_NO_UNICODE
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(FILE* __stream, string_view __fmt, format_args __args) {
- __print::__vprint_unicode(__stream, __fmt, __args, false);
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args __args) {
- std::vprint_unicode(stdout, __fmt, __args);
-}
-
-# endif // _LIBCPP_HAS_NO_UNICODE
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args) {
- __print::__vprint_nonunicode(__stream, __fmt, __args, false);
-}
-
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(string_view __fmt, format_args __args) {
- std::vprint_nonunicode(stdout, __fmt, __args);
-}
-
-#endif // _LIBCPP_STD_VER >= 23
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03_PRINT
diff --git a/libcxx/include/__cxx03/queue b/libcxx/include/__cxx03/queue
index 5f0189e61ee45..3c8ab50ed5245 100644
--- a/libcxx/include/__cxx03/queue
+++ b/libcxx/include/__cxx03/queue
@@ -257,7 +257,6 @@ template <class T, class Container, class Compare>
#include <__cxx03/__algorithm/make_heap.h>
#include <__cxx03/__algorithm/pop_heap.h>
#include <__cxx03/__algorithm/push_heap.h>
-#include <__cxx03/__algorithm/ranges_copy.h>
#include <__cxx03/__config>
#include <__cxx03/__functional/operations.h>
#include <__cxx03/__fwd/deque.h>
@@ -265,21 +264,11 @@ template <class T, class Container, class Compare>
#include <__cxx03/__iterator/back_insert_iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/uses_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/deque>
#include <__cxx03/vector>
#include <__cxx03/version>
-// standard-mandated includes
-
-// [queue.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -947,7 +936,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/random b/libcxx/include/__cxx03/random
index 71c59edecfec0..0bdb5a2a78fb1 100644
--- a/libcxx/include/__cxx03/random
+++ b/libcxx/include/__cxx03/random
@@ -1709,16 +1709,10 @@ class piecewise_linear_distribution
#include <__cxx03/__random/student_t_distribution.h>
#include <__cxx03/__random/subtract_with_carry_engine.h>
#include <__cxx03/__random/uniform_int_distribution.h>
-#include <__cxx03/__random/uniform_random_bit_generator.h>
#include <__cxx03/__random/uniform_real_distribution.h>
#include <__cxx03/__random/weibull_distribution.h>
#include <__cxx03/version>
-// standard-mandated includes
-
-// [rand.synopsis]
-#include <__cxx03/initializer_list>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -1727,7 +1721,6 @@ class piecewise_linear_distribution
# include <__cxx03/algorithm>
# include <__cxx03/climits>
# include <__cxx03/cmath>
-# include <__cxx03/concepts>
# include <__cxx03/cstddef>
# include <__cxx03/cstdint>
# include <__cxx03/cstdlib>
diff --git a/libcxx/include/__cxx03/ranges b/libcxx/include/__cxx03/ranges
deleted file mode 100644
index a762a0c2ae758..0000000000000
--- a/libcxx/include/__cxx03/ranges
+++ /dev/null
@@ -1,463 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_RANGES
-#define _LIBCPP___CXX03_RANGES
-
-/*
-
-#include <__cxx03/compare> // see [compare.syn]
-#include <__cxx03/initializer_list> // see [initializer.list.syn]
-#include <__cxx03/iterator> // see [iterator.synopsis]
-
-namespace std::ranges {
- inline namespace unspecified {
- // [range.access], range access
- inline constexpr unspecified begin = unspecified;
- inline constexpr unspecified end = unspecified;
- inline constexpr unspecified cbegin = unspecified;
- inline constexpr unspecified cend = unspecified;
-
- inline constexpr unspecified size = unspecified;
- inline constexpr unspecified ssize = unspecified;
- }
-
- // [range.range], ranges
- template<class T>
- concept range = see below;
-
- template<class T>
- inline constexpr bool enable_borrowed_range = false;
-
- template<class T>
- using iterator_t = decltype(ranges::begin(declval<T&>()));
- template<range R>
- using sentinel_t = decltype(ranges::end(declval<R&>()));
- template<range R>
- using range_difference_t = iter_difference_t<iterator_t<R>>;
- template<sized_range R>
- using range_size_t = decltype(ranges::size(declval<R&>()));
- template<range R>
- using range_value_t = iter_value_t<iterator_t<R>>;
- template<range R>
- using range_reference_t = iter_reference_t<iterator_t<R>>;
- template<range R>
- using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
- template <range R>
- using range_common_reference_t = iter_common_reference_t<iterator_t<R>>;
-
- // [range.sized], sized ranges
- template<class>
- inline constexpr bool disable_sized_range = false;
-
- template<class T>
- concept sized_range = ...;
-
- // [range.view], views
- template<class T>
- inline constexpr bool enable_view = ...;
-
- struct view_base { };
-
- template<class T>
- concept view = ...;
-
- // [range.refinements], other range refinements
- template<class R, class T>
- concept output_range = see below;
-
- template<class T>
- concept input_range = see below;
-
- template<class T>
- concept forward_range = see below;
-
- template<class T>
- concept bidirectional_range = see below;
-
- template<class T>
- concept random_access_range = see below;
-
- template<class T>
- concept contiguous_range = see below;
-
- template <class _Tp>
- concept common_range = see below;
-
- template<class T>
- concept viewable_range = see below;
-
- // [range.adaptor.object], range adaptor objects
- template<class D>
- requires is_class_v<D> && same_as<D, remove_cv_t<D>>
- class range_adaptor_closure { }; // Since c++23
-
- // [view.interface], class template view_interface
- template<class D>
- requires is_class_v<D> && same_as<D, remove_cv_t<D>>
- class view_interface;
-
- // [range.subrange], sub-ranges
- enum class subrange_kind : bool { unsized, sized };
-
- template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below>
- requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
- class subrange;
-
- template<class I, class S, subrange_kind K>
- inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
-
- // [range.dangling], dangling iterator handling
- struct dangling;
-
- template<range R>
- using borrowed_iterator_t = see below;
-
- template<range R>
- using borrowed_subrange_t = see below;
-
- // [range.elements], elements view
- template<input_range V, size_t N>
- requires see below
- class elements_view;
-
- template<class T, size_t N>
- inline constexpr bool enable_borrowed_range<elements_view<T, N>> =
- enable_borrowed_range<T>;
-
- template<class R>
- using keys_view = elements_view<R, 0>;
- template<class R>
- using values_view = elements_view<R, 1>;
-
- namespace views {
- template<size_t N>
- inline constexpr unspecified elements = unspecified;
- inline constexpr auto keys = elements<0>;
- inline constexpr auto values = elements<1>;
- }
-
- // [range.utility.conv], range conversions
- template<class C, input_range R, class... Args> requires (!view<C>)
- constexpr C to(R&& r, Args&&... args); // Since C++23
- template<template<class...> class C, input_range R, class... Args>
- constexpr auto to(R&& r, Args&&... args); // Since C++23
- template<class C, class... Args> requires (!view<C>)
- constexpr auto to(Args&&... args); // Since C++23
- template<template<class...> class C, class... Args>
- constexpr auto to(Args&&... args); // Since C++23
-
- // [range.empty], empty view
- template<class T>
- requires is_object_v<T>
- class empty_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<empty_view<T>> = true;
-
- namespace views {
- template<class T>
- inline constexpr empty_view<T> empty{};
- }
-
- // [range.all], all view
- namespace views {
- inline constexpr unspecified all = unspecified;
-
- template<viewable_range R>
- using all_t = decltype(all(declval<R>()));
- }
-
- template<range R>
- requires is_object_v<R>
- class ref_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<ref_view<T>> = true;
-
- template<range R>
- requires see below
- class owning_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<owning_view<T>> = enable_borrowed_range<T>;
-
- // [range.filter], filter view
- template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
- requires view<V> && is_object_v<Pred>
- class filter_view;
-
- namespace views {
- inline constexpr unspecified filter = unspecified;
- }
-
- // [range.drop], drop view
- template<view V>
- class drop_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>;
-
- // [range.drop.while], drop while view
- template<view V, class Pred>
- requires input_range<V> && is_object_v<Pred> &&
- indirect_unary_predicate<const Pred, iterator_t<V>>
- class drop_while_view;
-
- template<class T, class Pred>
- inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =
- enable_borrowed_range<T>;
-
- namespace views { inline constexpr unspecified drop_while = unspecified; }
-
- // [range.transform], transform view
- template<input_range V, copy_constructible F>
- requires view<V> && is_object_v<F> &&
- regular_invocable<F&, range_reference_t<V>> &&
- can-reference<invoke_result_t<F&, range_reference_t<V>>>
- class transform_view;
-
- // [range.counted], counted view
- namespace views { inline constexpr unspecified counted = unspecified; }
-
- // [range.common], common view
- template<view V>
- requires (!common_range<V> && copyable<iterator_t<V>>)
- class common_view;
-
- // [range.reverse], reverse view
- template<view V>
- requires bidirectional_range<V>
- class reverse_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>;
-
- // [range.take], take view
- template<view> class take_view;
-
- template<class T>
- inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>;
-
- // [range.take.while], take while view
- template<view V, class Pred>
- requires input_range<V> && is_object_v<Pred> &&
- indirect_unary_predicate<const Pred, iterator_t<V>>
- class take_while_view;
-
- namespace views { inline constexpr unspecified take_while = unspecified; }
-
- template<copy_constructible T>
- requires is_object_v<T>
- class single_view;
-
- template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
- requires weakly-equality-comparable-with<W, Bound> && copyable<W>
- class iota_view;
-
- template<class W, class Bound>
- inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
-
- // [range.repeat], repeat view
- template<class T>
- concept integer-like-with-usable-difference-type = // exposition only
- is-signed-integer-like<T> || (is-integer-like<T> && weakly_incrementable<T>);
-
- template<move_constructible T, semiregular Bound = unreachable_sentinel_t>
- requires (is_object_v<T> && same_as<T, remove_cv_t<T>> &&
- (integer-like-with-usable-difference-type<Bound> ||
- same_as<Bound, unreachable_sentinel_t>))
- class repeat_view;
-
- namespace views { inline constexpr unspecified repeat = unspecified; }
-
- // [range.join], join view
- template<input_range V>
- requires view<V> && input_range<range_reference_t<V>>
- class join_view;
-
- // [range.lazy.split], lazy split view
- template<class R>
- concept tiny-range = see below; // exposition only
-
- template<input_range V, forward_range Pattern>
- requires view<V> && view<Pattern> &&
- indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
- (forward_range<V> || tiny-range<Pattern>)
- class lazy_split_view;
-
- // [range.split], split view
- template<forward_range V, forward_range Pattern>
- requires view<V> && view<Pattern> &&
- indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
- class split_view;
-
- namespace views {
- inline constexpr unspecified lazy_split = unspecified;
- inline constexpr unspecified split = unspecified;
- }
-
- // [range.istream], istream view
- template<movable Val, class CharT, class Traits = char_traits<CharT>>
- requires see below
- class basic_istream_view;
-
- template<class Val>
- using istream_view = basic_istream_view<Val, char>;
-
- template<class Val>
- using wistream_view = basic_istream_view<Val, wchar_t>;
-
- namespace views { template<class T> inline constexpr unspecified istream = unspecified; }
-
- // [range.zip], zip view
- template<input_range... Views>
- requires (view<Views> && ...) && (sizeof...(Views) > 0)
- class zip_view; // C++23
-
- template<class... Views>
- inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++23
- (enable_borrowed_range<Views> && ...);
-
- namespace views { inline constexpr unspecified zip = unspecified; } // C++23
-
- // [range.as.rvalue]
- template <view V>
- requires input_range<V>
- class as_rvalue_view; // C++23
-
- namespace views { inline constexpr unspecified as_rvalue ) unspecified; } // C++23
-
- [range.chunk.by]
- template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
- requires view<V> && is_object_v<Pred>
- class chunk_by_view; // C++23
-
- namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23
-}
-
-namespace std {
- namespace views = ranges::views;
-
- template<class T> struct tuple_size;
- template<size_t I, class T> struct tuple_element;
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_size<ranges::subrange<I, S, K>>
- : integral_constant<size_t, 2> {};
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<0, ranges::subrange<I, S, K>> {
- using type = I;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<1, ranges::subrange<I, S, K>> {
- using type = S;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<0, const ranges::subrange<I, S, K>> {
- using type = I;
- };
-
- template<class I, class S, ranges::subrange_kind K>
- struct tuple_element<1, const ranges::subrange<I, S, K>> {
- using type = S;
- };
-
- struct from_range_t { explicit from_range_t() = default; }; // Since C++23
- inline constexpr from_range_t from_range{}; // Since C++23
-}
-*/
-
-#include <__cxx03/__config>
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__ranges/access.h>
-# include <__cxx03/__ranges/all.h>
-# include <__cxx03/__ranges/common_view.h>
-# include <__cxx03/__ranges/concepts.h>
-# include <__cxx03/__ranges/counted.h>
-# include <__cxx03/__ranges/dangling.h>
-# include <__cxx03/__ranges/data.h>
-# include <__cxx03/__ranges/drop_view.h>
-# include <__cxx03/__ranges/drop_while_view.h>
-# include <__cxx03/__ranges/elements_view.h>
-# include <__cxx03/__ranges/empty.h>
-# include <__cxx03/__ranges/empty_view.h>
-# include <__cxx03/__ranges/enable_borrowed_range.h>
-# include <__cxx03/__ranges/enable_view.h>
-# include <__cxx03/__ranges/filter_view.h>
-# include <__cxx03/__ranges/iota_view.h>
-# include <__cxx03/__ranges/join_view.h>
-# include <__cxx03/__ranges/lazy_split_view.h>
-# include <__cxx03/__ranges/rbegin.h>
-# include <__cxx03/__ranges/ref_view.h>
-# include <__cxx03/__ranges/rend.h>
-# include <__cxx03/__ranges/reverse_view.h>
-# include <__cxx03/__ranges/single_view.h>
-# include <__cxx03/__ranges/size.h>
-# include <__cxx03/__ranges/split_view.h>
-# include <__cxx03/__ranges/subrange.h>
-# include <__cxx03/__ranges/take_view.h>
-# include <__cxx03/__ranges/take_while_view.h>
-# include <__cxx03/__ranges/transform_view.h>
-# include <__cxx03/__ranges/view_interface.h>
-# include <__cxx03/__ranges/views.h>
-
-# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <__cxx03/__ranges/istream_view.h>
-# endif
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__ranges/as_rvalue_view.h>
-# include <__cxx03/__ranges/chunk_by_view.h>
-# include <__cxx03/__ranges/from_range.h>
-# include <__cxx03/__ranges/repeat_view.h>
-# include <__cxx03/__ranges/to.h>
-# include <__cxx03/__ranges/zip_view.h>
-#endif
-
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [ranges.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
-#include <__cxx03/iterator>
-
-// [tuple.helper]
-#include <__cxx03/__tuple/tuple_element.h>
-#include <__cxx03/__tuple/tuple_size.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <__cxx03/cstddef>
-# include <__cxx03/limits>
-# include <__cxx03/optional>
-# include <__cxx03/span>
-# include <__cxx03/tuple>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/cstdlib>
-# include <__cxx03/iosfwd>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_RANGES
diff --git a/libcxx/include/__cxx03/regex b/libcxx/include/__cxx03/regex
index ea9512cd56953..09c1d09834698 100644
--- a/libcxx/include/__cxx03/regex
+++ b/libcxx/include/__cxx03/regex
@@ -794,11 +794,9 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__iterator/back_insert_iterator.h>
-#include <__cxx03/__iterator/default_sentinel.h>
#include <__cxx03/__iterator/wrap_iter.h>
#include <__cxx03/__locale>
#include <__cxx03/__memory/shared_ptr.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
#include <__cxx03/__type_traits/is_swappable.h>
#include <__cxx03/__utility/move.h>
#include <__cxx03/__utility/pair.h>
@@ -814,14 +812,6 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [re.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -5820,7 +5810,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iosfwd>
# include <__cxx03/iterator>
diff --git a/libcxx/include/__cxx03/scoped_allocator b/libcxx/include/__cxx03/scoped_allocator
deleted file mode 100644
index faaca57302a60..0000000000000
--- a/libcxx/include/__cxx03/scoped_allocator
+++ /dev/null
@@ -1,573 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SCOPED_ALLOCATOR
-#define _LIBCPP___CXX03_SCOPED_ALLOCATOR
-
-/*
- scoped_allocator synopsis
-
-namespace std
-{
-
-template <class OuterAlloc, class... InnerAllocs>
-class scoped_allocator_adaptor : public OuterAlloc
-{
- typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
- scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
-public:
-
- typedef OuterAlloc outer_allocator_type;
- typedef see below inner_allocator_type;
-
- typedef typename OuterTraits::value_type value_type;
- typedef typename OuterTraits::size_type size_type;
- typedef typename OuterTraits::difference_type difference_type;
- typedef typename OuterTraits::pointer pointer;
- typedef typename OuterTraits::const_pointer const_pointer;
- typedef typename OuterTraits::void_pointer void_pointer;
- typedef typename OuterTraits::const_void_pointer const_void_pointer;
-
- typedef see below propagate_on_container_copy_assignment;
- typedef see below propagate_on_container_move_assignment;
- typedef see below propagate_on_container_swap;
- typedef see below is_always_equal;
-
- template <class Tp>
- struct rebind
- {
- typedef scoped_allocator_adaptor<
- OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
- };
-
- scoped_allocator_adaptor();
- template <class OuterA2>
- scoped_allocator_adaptor(OuterA2&& outerAlloc,
- const InnerAllocs&... innerAllocs) noexcept;
- scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
- scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
- template <class OuterA2>
- scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
- template <class OuterA2>
- scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
-
- scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
- scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
- ~scoped_allocator_adaptor();
-
- inner_allocator_type& inner_allocator() noexcept;
- const inner_allocator_type& inner_allocator() const noexcept;
-
- outer_allocator_type& outer_allocator() noexcept;
- const outer_allocator_type& outer_allocator() const noexcept;
-
- pointer allocate(size_type n); // [[nodiscard]] in C++20
- pointer allocate(size_type n, const_void_pointer hint); // [[nodiscard]] in C++20
- void deallocate(pointer p, size_type n) noexcept;
-
- size_type max_size() const;
- template <class T, class... Args> void construct(T* p, Args&& args);
- template <class T1, class T2, class... Args1, class... Args2>
- void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
- tuple<Args2...> y);
- template <class T1, class T2>
- void construct(pair<T1, T2>* p);
- template <class T1, class T2, class U, class V>
- void construct(pair<T1, T2>* p, U&& x, V&& y);
- template <class T1, class T2, class U, class V>
- void construct(pair<T1, T2>* p, const pair<U, V>& x);
- template <class T1, class T2, class U, class V>
- void construct(pair<T1, T2>* p, pair<U, V>&& x);
- template <class T> void destroy(T* p);
-
- template <class T> void destroy(T* p) noexcept;
-
- scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
-};
-
-template<class OuterAlloc, class... InnerAllocs>
- scoped_allocator_adaptor(OuterAlloc, InnerAllocs...)
- -> scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>;
-
-template <class OuterA1, class OuterA2, class... InnerAllocs>
- bool
- operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
- const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
-
-template <class OuterA1, class OuterA2, class... InnerAllocs>
- bool
- operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
- const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept; // removed in C++20
-
-} // std
-
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/__memory/allocator_traits.h>
-#include <__cxx03/__memory/uses_allocator_construction.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/pair.h>
-#include <__cxx03/__utility/piecewise_construct.h>
-#include <__cxx03/tuple>
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if !defined(_LIBCPP_CXX03_LANG)
-
-// scoped_allocator_adaptor
-
-template <class... _Allocs>
-class scoped_allocator_adaptor;
-
-template <class... _Allocs>
-struct __get_poc_copy_assignment;
-
-template <class _A0>
-struct __get_poc_copy_assignment<_A0> {
- static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value;
-};
-
-template <class _A0, class... _Allocs>
-struct __get_poc_copy_assignment<_A0, _Allocs...> {
- static const bool value = allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
- __get_poc_copy_assignment<_Allocs...>::value;
-};
-
-template <class... _Allocs>
-struct __get_poc_move_assignment;
-
-template <class _A0>
-struct __get_poc_move_assignment<_A0> {
- static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value;
-};
-
-template <class _A0, class... _Allocs>
-struct __get_poc_move_assignment<_A0, _Allocs...> {
- static const bool value = allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
- __get_poc_move_assignment<_Allocs...>::value;
-};
-
-template <class... _Allocs>
-struct __get_poc_swap;
-
-template <class _A0>
-struct __get_poc_swap<_A0> {
- static const bool value = allocator_traits<_A0>::propagate_on_container_swap::value;
-};
-
-template <class _A0, class... _Allocs>
-struct __get_poc_swap<_A0, _Allocs...> {
- static const bool value =
- allocator_traits<_A0>::propagate_on_container_swap::value || __get_poc_swap<_Allocs...>::value;
-};
-
-template <class... _Allocs>
-struct __get_is_always_equal;
-
-template <class _A0>
-struct __get_is_always_equal<_A0> {
- static const bool value = allocator_traits<_A0>::is_always_equal::value;
-};
-
-template <class _A0, class... _Allocs>
-struct __get_is_always_equal<_A0, _Allocs...> {
- static const bool value = allocator_traits<_A0>::is_always_equal::value && __get_is_always_equal<_Allocs...>::value;
-};
-
-template <class... _Allocs>
-class __scoped_allocator_storage;
-
-template <class _OuterAlloc, class... _InnerAllocs>
-class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> : public _OuterAlloc {
- typedef _OuterAlloc outer_allocator_type;
-
-protected:
- typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
-
-private:
- inner_allocator_type __inner_;
-
-protected:
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)),
- __inner_(__inner_allocs...) {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()),
- __inner_(__other.inner_allocator()) {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())),
- __inner_(std::move(__other.inner_allocator())) {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __o, const inner_allocator_type& __i) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__o)),
- __inner_(__i) {}
-
- _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return __inner_; }
- _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT { return __inner_; }
-
- _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
- return static_cast<outer_allocator_type&>(*this);
- }
- _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
- return static_cast<const outer_allocator_type&>(*this);
- }
-
- scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> _LIBCPP_HIDE_FROM_ABI
- select_on_container_copy_construction() const _NOEXCEPT {
- return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>(
- allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()),
- allocator_traits<inner_allocator_type>::select_on_container_copy_construction(inner_allocator()));
- }
-
- template <class...>
- friend class __scoped_allocator_storage;
-};
-
-template <class _OuterAlloc>
-class __scoped_allocator_storage<_OuterAlloc> : public _OuterAlloc {
- typedef _OuterAlloc outer_allocator_type;
-
-protected:
- typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
-
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage() _NOEXCEPT {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(_OuterA2&& __outer_alloc) _NOEXCEPT
- : outer_allocator_type(std::forward<_OuterA2>(__outer_alloc)) {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
- : outer_allocator_type(__other.outer_allocator()) {}
-
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI __scoped_allocator_storage(__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
- : outer_allocator_type(std::move(__other.outer_allocator())) {}
-
- _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT {
- return static_cast<inner_allocator_type&>(*this);
- }
- _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
- return static_cast<const inner_allocator_type&>(*this);
- }
-
- _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT {
- return static_cast<outer_allocator_type&>(*this);
- }
- _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
- return static_cast<const outer_allocator_type&>(*this);
- }
-
- _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor<outer_allocator_type>
- select_on_container_copy_construction() const _NOEXCEPT {
- return scoped_allocator_adaptor<outer_allocator_type>(
- allocator_traits<outer_allocator_type>::select_on_container_copy_construction(outer_allocator()));
- }
-
- __scoped_allocator_storage(const outer_allocator_type& __o, const inner_allocator_type& __i) _NOEXCEPT;
-
- template <class...>
- friend class __scoped_allocator_storage;
-};
-
-// __outermost
-
-template <class _Alloc>
-decltype(std::declval<_Alloc>().outer_allocator(), true_type()) __has_outer_allocator_test(_Alloc&& __a);
-
-template <class _Alloc>
-false_type __has_outer_allocator_test(const volatile _Alloc& __a);
-
-template <class _Alloc>
-struct __has_outer_allocator
- : public common_type< decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>()))>::type {};
-
-template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
-struct __outermost {
- typedef _Alloc type;
- _LIBCPP_HIDE_FROM_ABI type& operator()(type& __a) const _NOEXCEPT { return __a; }
-};
-
-template <class _Alloc>
-struct __outermost<_Alloc, true> {
- typedef __libcpp_remove_reference_t< decltype(std::declval<_Alloc>().outer_allocator()) > _OuterAlloc;
- typedef typename __outermost<_OuterAlloc>::type type;
- _LIBCPP_HIDE_FROM_ABI type& operator()(_Alloc& __a) const _NOEXCEPT {
- return __outermost<_OuterAlloc>()(__a.outer_allocator());
- }
-};
-
-template <class _OuterAlloc, class... _InnerAllocs>
-class _LIBCPP_TEMPLATE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
- : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> {
- typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> _Base;
- typedef allocator_traits<_OuterAlloc> _OuterTraits;
-
-public:
- typedef _OuterAlloc outer_allocator_type;
- typedef typename _Base::inner_allocator_type inner_allocator_type;
- typedef typename _OuterTraits::size_type size_type;
- typedef typename _OuterTraits::difference_type difference_type;
- typedef typename _OuterTraits::pointer pointer;
- typedef typename _OuterTraits::const_pointer const_pointer;
- typedef typename _OuterTraits::void_pointer void_pointer;
- typedef typename _OuterTraits::const_void_pointer const_void_pointer;
-
- typedef integral_constant< bool, __get_poc_copy_assignment<outer_allocator_type, _InnerAllocs...>::value >
- propagate_on_container_copy_assignment;
- typedef integral_constant< bool, __get_poc_move_assignment<outer_allocator_type, _InnerAllocs...>::value >
- propagate_on_container_move_assignment;
- typedef integral_constant< bool, __get_poc_swap<outer_allocator_type, _InnerAllocs...>::value >
- propagate_on_container_swap;
- typedef integral_constant< bool, __get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value >
- is_always_equal;
-
- template <class _Tp>
- struct rebind {
- typedef scoped_allocator_adaptor< typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs... > other;
- };
-
- _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor() _NOEXCEPT {}
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(_OuterA2&& __outer_alloc, const _InnerAllocs&... __inner_allocs) _NOEXCEPT
- : _Base(std::forward<_OuterA2>(__outer_alloc), __inner_allocs...) {}
- // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, const _OuterA2&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
- : _Base(__other) {}
- template <class _OuterA2, __enable_if_t<is_constructible<outer_allocator_type, _OuterA2>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- scoped_allocator_adaptor(scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
- : _Base(std::move(__other)) {}
-
- // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
- // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
- // ~scoped_allocator_adaptor() = default;
-
- _LIBCPP_HIDE_FROM_ABI inner_allocator_type& inner_allocator() _NOEXCEPT { return _Base::inner_allocator(); }
- _LIBCPP_HIDE_FROM_ABI const inner_allocator_type& inner_allocator() const _NOEXCEPT {
- return _Base::inner_allocator();
- }
-
- _LIBCPP_HIDE_FROM_ABI outer_allocator_type& outer_allocator() _NOEXCEPT { return _Base::outer_allocator(); }
- _LIBCPP_HIDE_FROM_ABI const outer_allocator_type& outer_allocator() const _NOEXCEPT {
- return _Base::outer_allocator();
- }
-
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n) {
- return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n);
- }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI pointer allocate(size_type __n, const_void_pointer __hint) {
- return allocator_traits<outer_allocator_type>::allocate(outer_allocator(), __n, __hint);
- }
-
- _LIBCPP_HIDE_FROM_ABI void deallocate(pointer __p, size_type __n) _NOEXCEPT {
- allocator_traits<outer_allocator_type>::deallocate(outer_allocator(), __p, __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI size_type max_size() const {
- return allocator_traits<outer_allocator_type>::max_size(outer_allocator());
- }
-
-# if _LIBCPP_STD_VER >= 20
- template <class _Type, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void construct(_Type* __ptr, _Args&&... __args) {
- using _OM = __outermost<outer_allocator_type>;
- std::apply(
- [__ptr, this](auto&&... __newargs) {
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __ptr, std::forward<decltype(__newargs)>(__newargs)...);
- },
- std::uses_allocator_construction_args<_Type>(inner_allocator(), std::forward<_Args>(__args)...));
- }
-# else
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void construct(_Tp* __p, _Args&&... __args) {
- __construct(__uses_alloc_ctor<_Tp, inner_allocator_type&, _Args...>(), __p, std::forward<_Args>(__args)...);
- }
-
- template <class _T1, class _T2, class... _Args1, class... _Args2>
- _LIBCPP_HIDE_FROM_ABI void
- construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()),
- __p,
- piecewise_construct,
- __transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
- std::move(__x),
- typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
- __transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
- std::move(__y),
- typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
- }
-
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p) {
- construct(__p, piecewise_construct, tuple<>{}, tuple<>{});
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, _Up&& __x, _Vp&& __y) {
- construct(__p,
- piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x)),
- std::forward_as_tuple(std::forward<_Vp>(__y)));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, const pair<_Up, _Vp>& __x) {
- construct(__p, piecewise_construct, std::forward_as_tuple(__x.first), std::forward_as_tuple(__x.second));
- }
-
- template <class _T1, class _T2, class _Up, class _Vp>
- _LIBCPP_HIDE_FROM_ABI void construct(pair<_T1, _T2>* __p, pair<_Up, _Vp>&& __x) {
- construct(__p,
- piecewise_construct,
- std::forward_as_tuple(std::forward<_Up>(__x.first)),
- std::forward_as_tuple(std::forward<_Vp>(__x.second)));
- }
-# endif
-
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI void destroy(_Tp* __p) {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::destroy(_OM()(outer_allocator()), __p);
- }
-
- _LIBCPP_HIDE_FROM_ABI scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT {
- return _Base::select_on_container_copy_construction();
- }
-
-private:
- _LIBCPP_HIDE_FROM_ABI explicit scoped_allocator_adaptor(
- outer_allocator_type&& __o, inner_allocator_type&& __i) _NOEXCEPT : _Base(std::move(__o), std::move(__i)) {}
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 0>, _Tp* __p, _Args&&... __args) {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(_OM()(outer_allocator()), __p, std::forward<_Args>(__args)...);
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 1>, _Tp* __p, _Args&&... __args) {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __p, allocator_arg, inner_allocator(), std::forward<_Args>(__args)...);
- }
-
- template <class _Tp, class... _Args>
- _LIBCPP_HIDE_FROM_ABI void __construct(integral_constant<int, 2>, _Tp* __p, _Args&&... __args) {
- typedef __outermost<outer_allocator_type> _OM;
- allocator_traits<typename _OM::type>::construct(
- _OM()(outer_allocator()), __p, std::forward<_Args>(__args)..., inner_allocator());
- }
-
- template <class... _Args, size_t... _Idx>
- _LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
- return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
- }
-
- template <class... _Args, size_t... _Idx>
- _LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
- using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
- return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
- }
-
- template <class... _Args, size_t... _Idx>
- _LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
- using _Tup = tuple<_Args&&..., inner_allocator_type&>;
- return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
- }
-
- template <class...>
- friend class __scoped_allocator_storage;
-};
-
-# if _LIBCPP_STD_VER >= 17
-template <class _OuterAlloc, class... _InnerAllocs>
-scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...) -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
-# endif
-
-template <class _OuterA1, class _OuterA2>
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const scoped_allocator_adaptor<_OuterA1>& __a, const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT {
- return __a.outer_allocator() == __b.outer_allocator();
-}
-
-template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI bool
-operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT {
- return __a.outer_allocator() == __b.outer_allocator() && __a.inner_allocator() == __b.inner_allocator();
-}
-
-# if _LIBCPP_STD_VER <= 17
-
-template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
- const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT {
- return !(__a == __b);
-}
-
-# endif // _LIBCPP_STD_VER <= 17
-
-#endif // !defined(_LIBCPP_CXX03_LANG)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-# include <__cxx03/climits>
-# include <__cxx03/concepts>
-# include <__cxx03/cstring>
-# include <__cxx03/ctime>
-# include <__cxx03/iterator>
-# include <__cxx03/memory>
-# include <__cxx03/ratio>
-# include <__cxx03/stdexcept>
-# include <__cxx03/type_traits>
-# include <__cxx03/variant>
-#endif
-
-#endif // _LIBCPP___CXX03_SCOPED_ALLOCATOR
diff --git a/libcxx/include/__cxx03/semaphore b/libcxx/include/__cxx03/semaphore
deleted file mode 100644
index 8e07f1a910d0c..0000000000000
--- a/libcxx/include/__cxx03/semaphore
+++ /dev/null
@@ -1,188 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SEMAPHORE
-#define _LIBCPP___CXX03_SEMAPHORE
-
-/*
- semaphore synopsis
-
-namespace std {
-
-template<ptrdiff_t least_max_value = implementation-defined>
-class counting_semaphore
-{
-public:
-static constexpr ptrdiff_t max() noexcept;
-
-constexpr explicit counting_semaphore(ptrdiff_t desired);
-~counting_semaphore();
-
-counting_semaphore(const counting_semaphore&) = delete;
-counting_semaphore& operator=(const counting_semaphore&) = delete;
-
-void release(ptrdiff_t update = 1);
-void acquire();
-bool try_acquire() noexcept;
-template<class Rep, class Period>
- bool try_acquire_for(const chrono::duration<Rep, Period>& rel_time);
-template<class Clock, class Duration>
- bool try_acquire_until(const chrono::time_point<Clock, Duration>& abs_time);
-
-private:
-ptrdiff_t counter; // exposition only
-};
-
-using binary_semaphore = counting_semaphore<1>;
-
-}
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-
-# include <__cxx03/__assert>
-# include <__cxx03/__atomic/atomic_base.h>
-# include <__cxx03/__atomic/atomic_sync.h>
-# include <__cxx03/__atomic/memory_order.h>
-# include <__cxx03/__chrono/time_point.h>
-# include <__cxx03/__thread/poll_with_backoff.h>
-# include <__cxx03/__thread/support.h>
-# include <__cxx03/__thread/timed_backoff_policy.h>
-# include <__cxx03/cstddef>
-# include <__cxx03/limits>
-# include <__cxx03/version>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-# if _LIBCPP_STD_VER >= 14
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-/*
-
-__atomic_semaphore_base is the general-case implementation.
-It is a typical Dijkstra semaphore algorithm over atomics, wait and notify
-functions. It avoids contention against users' own use of those facilities.
-
-*/
-
-# define _LIBCPP_SEMAPHORE_MAX (numeric_limits<ptrdiff_t>::max())
-
-class __atomic_semaphore_base {
- __atomic_base<ptrdiff_t> __a_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {}
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
- auto __old = __a_.fetch_add(__update, memory_order_release);
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
- if (__old == 0) {
- __a_.notify_all();
- }
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() {
- std::__atomic_wait_unless(
- __a_, [this](ptrdiff_t& __old) { return __try_acquire_impl(__old); }, memory_order_relaxed);
- }
- template <class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
- try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
- if (__rel_time == chrono::duration<_Rep, _Period>::zero())
- return try_acquire();
- auto const __poll_fn = [this]() { return try_acquire(); };
- return std::__libcpp_thread_poll_with_backoff(__poll_fn, __libcpp_timed_backoff_policy(), __rel_time);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() {
- auto __old = __a_.load(memory_order_relaxed);
- return __try_acquire_impl(__old);
- }
-
-private:
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __try_acquire_impl(ptrdiff_t& __old) {
- while (true) {
- if (__old == 0)
- return false;
- if (__a_.compare_exchange_weak(__old, __old - 1, memory_order_acquire, memory_order_relaxed))
- return true;
- }
- }
-};
-
-template <ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
-class _LIBCPP_DEPRECATED_ATOMIC_SYNC counting_semaphore {
- __atomic_semaphore_base __semaphore_;
-
-public:
- static_assert(__least_max_value >= 0, "The least maximum value must be a positive number");
-
- static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __count >= 0,
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a negative value");
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
- __count <= max(),
- "counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
- "initialized with a value greater than max()");
- }
- ~counting_semaphore() = default;
-
- counting_semaphore(const counting_semaphore&) = delete;
- counting_semaphore& operator=(const counting_semaphore&) = delete;
-
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "counting_semaphore:release called with a negative value");
- __semaphore_.release(__update);
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
- template <class _Rep, class _Period>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
- try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
- return __semaphore_.try_acquire_for(chrono::duration_cast<chrono::nanoseconds>(__rel_time));
- }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool try_acquire() { return __semaphore_.try_acquire(); }
- template <class _Clock, class _Duration>
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool
- try_acquire_until(chrono::time_point<_Clock, _Duration> const& __abs_time) {
- auto const __current = _Clock::now();
- if (__current >= __abs_time)
- return try_acquire();
- else
- return try_acquire_for(__abs_time - __current);
- }
-};
-
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
-using binary_semaphore _LIBCPP_DEPRECATED_ATOMIC_SYNC = counting_semaphore<1>;
-_LIBCPP_SUPPRESS_DEPRECATED_POP
-
-_LIBCPP_END_NAMESPACE_STD
-
-# endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/atomic>
-#endif
-
-#endif //_LIBCPP___CXX03_SEMAPHORE
diff --git a/libcxx/include/__cxx03/set b/libcxx/include/__cxx03/set
index 2b14ef8b39a9f..2e5b70be67448 100644
--- a/libcxx/include/__cxx03/set
+++ b/libcxx/include/__cxx03/set
@@ -514,21 +514,14 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
#include <__cxx03/__algorithm/equal.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__functional/is_transparent.h>
#include <__cxx03/__functional/operations.h>
#include <__cxx03/__iterator/erase_if_container.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/ranges_iterator_traits.h>
#include <__cxx03/__iterator/reverse_iterator.h>
#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__node_handle>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__tree>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__utility/forward.h>
@@ -538,14 +531,6 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [associative.set.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -1489,7 +1474,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
# include <__cxx03/iterator>
diff --git a/libcxx/include/__cxx03/shared_mutex b/libcxx/include/__cxx03/shared_mutex
deleted file mode 100644
index 7acecdafc36a9..0000000000000
--- a/libcxx/include/__cxx03/shared_mutex
+++ /dev/null
@@ -1,464 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SHARED_MUTEX
-#define _LIBCPP___CXX03_SHARED_MUTEX
-
-/*
- shared_mutex synopsis
-
-// C++1y
-
-namespace std
-{
-
-class shared_mutex // C++17
-{
-public:
- shared_mutex();
- ~shared_mutex();
-
- shared_mutex(const shared_mutex&) = delete;
- shared_mutex& operator=(const shared_mutex&) = delete;
-
- // Exclusive ownership
- void lock(); // blocking
- bool try_lock();
- void unlock();
-
- // Shared ownership
- void lock_shared(); // blocking
- bool try_lock_shared();
- void unlock_shared();
-
- typedef implementation-defined native_handle_type; // See 30.2.3
- native_handle_type native_handle(); // See 30.2.3
-};
-
-class shared_timed_mutex
-{
-public:
- shared_timed_mutex();
- ~shared_timed_mutex();
-
- shared_timed_mutex(const shared_timed_mutex&) = delete;
- shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
-
- // Exclusive ownership
- void lock(); // blocking
- bool try_lock();
- template <class Rep, class Period>
- bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
- template <class Clock, class Duration>
- bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
- void unlock();
-
- // Shared ownership
- void lock_shared(); // blocking
- bool try_lock_shared();
- template <class Rep, class Period>
- bool
- try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time);
- template <class Clock, class Duration>
- bool
- try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time);
- void unlock_shared();
-};
-
-template <class Mutex>
-class shared_lock
-{
-public:
- typedef Mutex mutex_type;
-
- // Shared locking
- shared_lock() noexcept;
- explicit shared_lock(mutex_type& m); // blocking
- shared_lock(mutex_type& m, defer_lock_t) noexcept;
- shared_lock(mutex_type& m, try_to_lock_t);
- shared_lock(mutex_type& m, adopt_lock_t);
- template <class Clock, class Duration>
- shared_lock(mutex_type& m,
- const chrono::time_point<Clock, Duration>& abs_time);
- template <class Rep, class Period>
- shared_lock(mutex_type& m,
- const chrono::duration<Rep, Period>& rel_time);
- ~shared_lock();
-
- shared_lock(shared_lock const&) = delete;
- shared_lock& operator=(shared_lock const&) = delete;
-
- shared_lock(shared_lock&& u) noexcept;
- shared_lock& operator=(shared_lock&& u) noexcept;
-
- void lock(); // blocking
- bool try_lock();
- template <class Rep, class Period>
- bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
- template <class Clock, class Duration>
- bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
- void unlock();
-
- // Setters
- void swap(shared_lock& u) noexcept;
- mutex_type* release() noexcept;
-
- // Getters
- bool owns_lock() const noexcept;
- explicit operator bool () const noexcept;
- mutex_type* mutex() const noexcept;
-};
-
-template <class Mutex>
- void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
-
-} // std
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-
-# include <__cxx03/__chrono/duration.h>
-# include <__cxx03/__chrono/steady_clock.h>
-# include <__cxx03/__chrono/time_point.h>
-# include <__cxx03/__condition_variable/condition_variable.h>
-# include <__cxx03/__memory/addressof.h>
-# include <__cxx03/__mutex/mutex.h>
-# include <__cxx03/__mutex/tag_types.h>
-# include <__cxx03/__mutex/unique_lock.h>
-# include <__cxx03/__system_error/system_error.h>
-# include <__cxx03/__utility/swap.h>
-# include <__cxx03/cerrno>
-# include <__cxx03/version>
-
-_LIBCPP_PUSH_MACROS
-# include <__cxx03/__undef_macros>
-
-# if _LIBCPP_STD_VER >= 14
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base {
- mutex __mut_;
- condition_variable __gate1_;
- condition_variable __gate2_;
- unsigned __state_;
-
- static const unsigned __write_entered_ = 1U << (sizeof(unsigned) * __CHAR_BIT__ - 1);
- static const unsigned __n_readers_ = ~__write_entered_;
-
- __shared_mutex_base();
- _LIBCPP_HIDE_FROM_ABI ~__shared_mutex_base() = default;
-
- __shared_mutex_base(const __shared_mutex_base&) = delete;
- __shared_mutex_base& operator=(const __shared_mutex_base&) = delete;
-
- // Exclusive ownership
- void lock(); // blocking
- bool try_lock();
- void unlock();
-
- // Shared ownership
- void lock_shared(); // blocking
- bool try_lock_shared();
- void unlock_shared();
-
- // typedef implementation-defined native_handle_type; // See 30.2.3
- // native_handle_type native_handle(); // See 30.2.3
-};
-
-# if _LIBCPP_STD_VER >= 17
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_mutex")) shared_mutex {
- __shared_mutex_base __base_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI shared_mutex() : __base_() {}
- _LIBCPP_HIDE_FROM_ABI ~shared_mutex() = default;
-
- shared_mutex(const shared_mutex&) = delete;
- shared_mutex& operator=(const shared_mutex&) = delete;
-
- // Exclusive ownership
- _LIBCPP_HIDE_FROM_ABI void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__acquire_capability__()) {
- return __base_.lock();
- }
- _LIBCPP_HIDE_FROM_ABI bool try_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_capability__(true)) {
- return __base_.try_lock();
- }
- _LIBCPP_HIDE_FROM_ABI void unlock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__release_capability__()) {
- return __base_.unlock();
- }
-
- // Shared ownership
- _LIBCPP_HIDE_FROM_ABI void lock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(__acquire_shared_capability__()) {
- return __base_.lock_shared();
- }
- _LIBCPP_HIDE_FROM_ABI bool try_lock_shared()
- _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_shared_capability__(true)) {
- return __base_.try_lock_shared();
- }
- _LIBCPP_HIDE_FROM_ABI void unlock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(__release_shared_capability__()) {
- return __base_.unlock_shared();
- }
-
- // typedef __shared_mutex_base::native_handle_type native_handle_type;
- // _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return __base::unlock_shared(); }
-};
-# endif
-
-class _LIBCPP_EXPORTED_FROM_ABI
-_LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_timed_mutex")) shared_timed_mutex {
- __shared_mutex_base __base_;
-
-public:
- shared_timed_mutex();
- _LIBCPP_HIDE_FROM_ABI ~shared_timed_mutex() = default;
-
- shared_timed_mutex(const shared_timed_mutex&) = delete;
- shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
-
- // Exclusive ownership
- void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__acquire_capability__());
- bool try_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_capability__(true));
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_capability__(true)) {
- return try_lock_until(chrono::steady_clock::now() + __rel_time);
- }
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
- try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_capability__(true));
- void unlock() _LIBCPP_THREAD_SAFETY_ANNOTATION(__release_capability__());
-
- // Shared ownership
- void lock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(__acquire_shared_capability__());
- bool try_lock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_shared_capability__(true));
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI bool try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_shared_capability__(true)) {
- return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
- }
- template <class _Clock, class _Duration>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool
- try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(__try_acquire_shared_capability__(true));
- void unlock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(__release_shared_capability__());
-};
-
-template <class _Clock, class _Duration>
-bool shared_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) {
- unique_lock<mutex> __lk(__base_.__mut_);
- if (__base_.__state_ & __base_.__write_entered_) {
- while (true) {
- cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time);
- if ((__base_.__state_ & __base_.__write_entered_) == 0)
- break;
- if (__status == cv_status::timeout)
- return false;
- }
- }
- __base_.__state_ |= __base_.__write_entered_;
- if (__base_.__state_ & __base_.__n_readers_) {
- while (true) {
- cv_status __status = __base_.__gate2_.wait_until(__lk, __abs_time);
- if ((__base_.__state_ & __base_.__n_readers_) == 0)
- break;
- if (__status == cv_status::timeout) {
- __base_.__state_ &= ~__base_.__write_entered_;
- __base_.__gate1_.notify_all();
- return false;
- }
- }
- }
- return true;
-}
-
-template <class _Clock, class _Duration>
-bool shared_timed_mutex::try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) {
- unique_lock<mutex> __lk(__base_.__mut_);
- if ((__base_.__state_ & __base_.__write_entered_) ||
- (__base_.__state_ & __base_.__n_readers_) == __base_.__n_readers_) {
- while (true) {
- cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time);
- if ((__base_.__state_ & __base_.__write_entered_) == 0 &&
- (__base_.__state_ & __base_.__n_readers_) < __base_.__n_readers_)
- break;
- if (__status == cv_status::timeout)
- return false;
- }
- }
- unsigned __num_readers = (__base_.__state_ & __base_.__n_readers_) + 1;
- __base_.__state_ &= ~__base_.__n_readers_;
- __base_.__state_ |= __num_readers;
- return true;
-}
-
-template <class _Mutex>
-class shared_lock {
-public:
- typedef _Mutex mutex_type;
-
-private:
- mutex_type* __m_;
- bool __owns_;
-
-public:
- _LIBCPP_HIDE_FROM_ABI shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit shared_lock(mutex_type& __m) : __m_(std::addressof(__m)), __owns_(true) {
- __m_->lock_shared();
- }
-
- _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
- : __m_(std::addressof(__m)),
- __owns_(false) {}
-
- _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, try_to_lock_t)
- : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared()) {}
-
- _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, adopt_lock_t) : __m_(std::addressof(__m)), __owns_(true) {}
-
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __abs_time)
- : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_until(__abs_time)) {}
-
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rel_time)
- : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_for(__rel_time)) {}
-
- _LIBCPP_HIDE_FROM_ABI ~shared_lock() {
- if (__owns_)
- __m_->unlock_shared();
- }
-
- shared_lock(shared_lock const&) = delete;
- shared_lock& operator=(shared_lock const&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI shared_lock(shared_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) {
- __u.__m_ = nullptr;
- __u.__owns_ = false;
- }
-
- _LIBCPP_HIDE_FROM_ABI shared_lock& operator=(shared_lock&& __u) _NOEXCEPT {
- if (__owns_)
- __m_->unlock_shared();
- __m_ = nullptr;
- __owns_ = false;
- __m_ = __u.__m_;
- __owns_ = __u.__owns_;
- __u.__m_ = nullptr;
- __u.__owns_ = false;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI void lock();
- _LIBCPP_HIDE_FROM_ABI bool try_lock();
- template <class _Rep, class _Period>
- _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time);
- template <class _Clock, class _Duration>
- _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
- _LIBCPP_HIDE_FROM_ABI void unlock();
-
- // Setters
- _LIBCPP_HIDE_FROM_ABI void swap(shared_lock& __u) _NOEXCEPT {
- std::swap(__m_, __u.__m_);
- std::swap(__owns_, __u.__owns_);
- }
-
- _LIBCPP_HIDE_FROM_ABI mutex_type* release() _NOEXCEPT {
- mutex_type* __m = __m_;
- __m_ = nullptr;
- __owns_ = false;
- return __m;
- }
-
- // Getters
- _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; }
-
- _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; }
-
- _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; }
-};
-_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock);
-
-template <class _Mutex>
-void shared_lock<_Mutex>::lock() {
- if (__m_ == nullptr)
- __throw_system_error(EPERM, "shared_lock::lock: references null mutex");
- if (__owns_)
- __throw_system_error(EDEADLK, "shared_lock::lock: already locked");
- __m_->lock_shared();
- __owns_ = true;
-}
-
-template <class _Mutex>
-bool shared_lock<_Mutex>::try_lock() {
- if (__m_ == nullptr)
- __throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
- if (__owns_)
- __throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
- __owns_ = __m_->try_lock_shared();
- return __owns_;
-}
-
-template <class _Mutex>
-template <class _Rep, class _Period>
-bool shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
- if (__m_ == nullptr)
- __throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
- if (__owns_)
- __throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
- __owns_ = __m_->try_lock_shared_for(__d);
- return __owns_;
-}
-
-template <class _Mutex>
-template <class _Clock, class _Duration>
-bool shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
- if (__m_ == nullptr)
- __throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
- if (__owns_)
- __throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
- __owns_ = __m_->try_lock_shared_until(__t);
- return __owns_;
-}
-
-template <class _Mutex>
-void shared_lock<_Mutex>::unlock() {
- if (!__owns_)
- __throw_system_error(EPERM, "shared_lock::unlock: not locked");
- __m_->unlock_shared();
- __owns_ = false;
-}
-
-template <class _Mutex>
-inline _LIBCPP_HIDE_FROM_ABI void swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT {
- __x.swap(__y);
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-# endif // _LIBCPP_STD_VER >= 14
-
-_LIBCPP_POP_MACROS
-
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/system_error>
-#endif
-
-#endif // _LIBCPP___CXX03_SHARED_MUTEX
diff --git a/libcxx/include/__cxx03/source_location b/libcxx/include/__cxx03/source_location
deleted file mode 100644
index 3cd36babe3bf3..0000000000000
--- a/libcxx/include/__cxx03/source_location
+++ /dev/null
@@ -1,85 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SOURCE_LOCATION
-#define _LIBCPP___CXX03_SOURCE_LOCATION
-
-/* source_location synopsis
-
-namespace std {
- struct source_location {
- static consteval source_location current() noexcept;
- constexpr source_location() noexcept;
-
- constexpr uint_least32_t line() const noexcept;
- constexpr uint_least32_t column() const noexcept;
- constexpr const char* file_name() const noexcept;
- constexpr const char* function_name() const noexcept;
- };
-}
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/cstdint>
-#include <__cxx03/version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-class source_location {
- // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column
- // are hard-coded in the compiler and must not be changed here.
- struct __impl {
- const char* _M_file_name;
- const char* _M_function_name;
- unsigned _M_line;
- unsigned _M_column;
- };
- const __impl* __ptr_ = nullptr;
- // GCC returns the type 'const void*' from the builtin, while clang returns
- // `const __impl*`. Per C++ [expr.const], casts from void* are not permitted
- // in constant evaluation, so we don't want to use `void*` as the argument
- // type unless the builtin returned that, anyhow, and the invalid cast is
- // unavoidable.
- using __bsl_ty = decltype(__builtin_source_location());
-
-public:
- // The defaulted __ptr argument is necessary so that the builtin is evaluated
- // in the context of the caller. An explicit value should never be provided.
- static consteval source_location current(__bsl_ty __ptr = __builtin_source_location()) noexcept {
- source_location __sl;
- __sl.__ptr_ = static_cast<const __impl*>(__ptr);
- return __sl;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr source_location() noexcept = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr uint_least32_t line() const noexcept {
- return __ptr_ != nullptr ? __ptr_->_M_line : 0;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr uint_least32_t column() const noexcept {
- return __ptr_ != nullptr ? __ptr_->_M_column : 0;
- }
- _LIBCPP_HIDE_FROM_ABI constexpr const char* file_name() const noexcept {
- return __ptr_ != nullptr ? __ptr_->_M_file_name : "";
- }
- _LIBCPP_HIDE_FROM_ABI constexpr const char* function_name() const noexcept {
- return __ptr_ != nullptr ? __ptr_->_M_function_name : "";
- }
-};
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___CXX03_SOURCE_LOCATION
diff --git a/libcxx/include/__cxx03/span b/libcxx/include/__cxx03/span
deleted file mode 100644
index 7d1ef460e5994..0000000000000
--- a/libcxx/include/__cxx03/span
+++ /dev/null
@@ -1,636 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SPAN
-#define _LIBCPP___CXX03_SPAN
-
-/*
- span synopsis
-
-namespace std {
-
-// constants
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
-
-template<class T>
- concept integral-constant-like = // exposition only, since C++26
- is_integral_v<decltype(T::value)> &&
- !is_same_v<bool, remove_const_t<decltype(T::value)>> &&
- convertible_to<T, decltype(T::value)> &&
- equality_comparable_with<T, decltype(T::value)> &&
- bool_constant<T() == T::value>::value &&
- bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;
-
-template<class T>
- constexpr size_t maybe-static-ext = dynamic_extent; // exposition only, since C++26
-template<integral-constant-like T>
- constexpr size_t maybe-static-ext<T> = {T::value};
-
-// [views.span], class template span
-template <class ElementType, size_t Extent = dynamic_extent>
- class span;
-
-template<class ElementType, size_t Extent>
- inline constexpr bool ranges::enable_view<span<ElementType, Extent>> = true;
-
-template<class ElementType, size_t Extent>
- inline constexpr bool ranges::enable_borrowed_range<span<ElementType, Extent>> = true;
-
-// [span.objectrep], views of object representation
-template <class ElementType, size_t Extent>
- span<const byte, ((Extent == dynamic_extent) ? dynamic_extent :
- (sizeof(ElementType) * Extent))> as_bytes(span<ElementType, Extent> s) noexcept;
-
-template <class ElementType, size_t Extent>
- span< byte, ((Extent == dynamic_extent) ? dynamic_extent :
- (sizeof(ElementType) * Extent))> as_writable_bytes(span<ElementType, Extent> s) noexcept;
-
-
-template <class ElementType, size_t Extent = dynamic_extent>
-class span {
-public:
- // constants and types
- using element_type = ElementType;
- using value_type = remove_cv_t<ElementType>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = element_type*;
- using const_pointer = const element_type*;
- using reference = element_type&;
- using const_reference = const element_type&;
- using iterator = implementation-defined;
- using reverse_iterator = std::reverse_iterator<iterator>;
- static constexpr size_type extent = Extent;
-
- // [span.cons], span constructors, copy, assignment, and destructor
- constexpr span() noexcept;
- template <class It>
- constexpr explicit(Extent != dynamic_extent) span(It first, size_type count);
- template <class It, class End>
- constexpr explicit(Extent != dynamic_extent) span(It first, End last);
- template <size_t N>
- constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
- template <size_t N>
- constexpr span(array<value_type, N>& arr) noexcept;
- template <size_t N>
- constexpr span(const array<value_type, N>& arr) noexcept;
- template<class R>
- constexpr explicit(Extent != dynamic_extent) span(R&& r);
- constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since C++26
- constexpr span(const span& other) noexcept = default;
- template <class OtherElementType, size_t OtherExtent>
- constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept;
- constexpr span& operator=(const span& other) noexcept = default;
-
- // [span.sub], span subviews
- template <size_t Count>
- constexpr span<element_type, Count> first() const;
- template <size_t Count>
- constexpr span<element_type, Count> last() const;
- template <size_t Offset, size_t Count = dynamic_extent>
- constexpr span<element_type, see below> subspan() const;
-
- constexpr span<element_type, dynamic_extent> first(size_type count) const;
- constexpr span<element_type, dynamic_extent> last(size_type count) const;
- constexpr span<element_type, dynamic_extent> subspan(size_type offset, size_type count = dynamic_extent) const;
-
- // [span.obs], span observers
- constexpr size_type size() const noexcept;
- constexpr size_type size_bytes() const noexcept;
- [[nodiscard]] constexpr bool empty() const noexcept;
-
- // [span.elem], span element access
- constexpr reference operator[](size_type idx) const;
- constexpr reference at(size_type idx) const; // since C++26
- constexpr reference front() const;
- constexpr reference back() const;
- constexpr pointer data() const noexcept;
-
- // [span.iterators], span iterator support
- constexpr iterator begin() const noexcept;
- constexpr iterator end() const noexcept;
- constexpr reverse_iterator rbegin() const noexcept;
- constexpr reverse_iterator rend() const noexcept;
-
-private:
- pointer data_; // exposition only
- size_type size_; // exposition only
-};
-
-template<class It, class EndOrSize>
- span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; // until C++26
-template<class It, class EndOrSize>
- span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>; // since C++26
-
-template<class T, size_t N>
- span(T (&)[N]) -> span<T, N>;
-
-template<class T, size_t N>
- span(array<T, N>&) -> span<T, N>;
-
-template<class T, size_t N>
- span(const array<T, N>&) -> span<const T, N>;
-
-template<class R>
- span(R&&) -> span<remove_reference_t<ranges::range_reference_t<R>>>;
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__assert>
-#include <__cxx03/__concepts/convertible_to.h>
-#include <__cxx03/__concepts/equality_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__fwd/array.h>
-#include <__cxx03/__fwd/span.h>
-#include <__cxx03/__iterator/bounded_iter.h>
-#include <__cxx03/__iterator/concepts.h>
-#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/reverse_iterator.h>
-#include <__cxx03/__iterator/wrap_iter.h>
-#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/enable_view.h>
-#include <__cxx03/__ranges/size.h>
-#include <__cxx03/__type_traits/integral_constant.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_const.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_integral.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_cv.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__type_traits/type_identity.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/cstddef> // for byte
-#include <__cxx03/initializer_list>
-#include <__cxx03/stdexcept>
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [iterator.range]
-#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Tp>
-struct __is_std_span : false_type {};
-
-template <class _Tp, size_t _Sz>
-struct __is_std_span<span<_Tp, _Sz>> : true_type {};
-
-template <class _Range, class _ElementType>
-concept __span_compatible_range =
- !__is_std_span<remove_cvref_t<_Range>>::value && //
- ranges::contiguous_range<_Range> && //
- ranges::sized_range<_Range> && //
- (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && //
- !__is_std_array<remove_cvref_t<_Range>>::value && //
- !is_array_v<remove_cvref_t<_Range>> && //
- is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>;
-
-template <class _From, class _To>
-concept __span_array_convertible = is_convertible_v<_From (*)[], _To (*)[]>;
-
-template <class _It, class _Tp>
-concept __span_compatible_iterator =
- contiguous_iterator<_It> && __span_array_convertible<remove_reference_t<iter_reference_t<_It>>, _Tp>;
-
-template <class _Sentinel, class _It>
-concept __span_compatible_sentinel_for = sized_sentinel_for<_Sentinel, _It> && !is_convertible_v<_Sentinel, size_t>;
-
-template <typename _Tp, size_t _Extent>
-class _LIBCPP_TEMPLATE_VIS span {
-public:
- // constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp*;
- using const_pointer = const _Tp*;
- using reference = _Tp&;
- using const_reference = const _Tp&;
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-# else
- using iterator = __wrap_iter<pointer>;
-# endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = _Extent;
-
- // [span.cons], span constructors, copy, assignment, and destructor
- template <size_t _Sz = _Extent>
- requires(_Sz == 0)
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
-
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il)
- requires is_const_v<element_type>
- : __data_{__il.begin()} {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(
- _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size().");
- }
-# endif
-
- constexpr span(const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, size_type __count) : __data_{std::to_address(__first)} {
- (void)__count;
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __count, "size mismatch in span's constructor (iterator, len)");
- }
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_It __first, _End __last) : __data_{std::to_address(__first)} {
- // [span.cons]/10
- // Throws: When and what last - first throws.
- [[maybe_unused]] auto __dist = __last - __first;
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent");
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Extent>& __arr) noexcept : __data_{__arr.data()} {}
-
- template <class _OtherElementType>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Extent>& __arr) noexcept
- : __data_{__arr.data()} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)");
- }
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _Extent>& __other) noexcept
- : __data_{__other.data()} {}
-
- template <__span_array_convertible<element_type> _OtherElementType>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept
- : __data_{__other.data()} {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Extent == __other.size(), "size mismatch in span's constructor (other span)");
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
- static_assert(_Count <= _Extent, "span<T, N>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
- static_assert(_Count <= _Extent, "span<T, N>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T, N>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI constexpr auto
- subspan() const noexcept -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
- static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
- static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
- "span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
-
- using _ReturnType = span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset>;
- return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent>
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return _Extent; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return _Extent * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return _Extent == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T, N>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
- if (__index >= size())
- std::__throw_out_of_range("span");
- return __data_[__index];
- }
-# endif
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T, N>::back() on empty span");
- return __data_[size() - 1];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
- // [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-# else
- return iterator(data());
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-# else
- return iterator(data() + size());
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, _Extent * sizeof(element_type)> __as_bytes() const noexcept {
- return span<const byte, _Extent * sizeof(element_type)>{reinterpret_cast<const byte*>(data()), size_bytes()};
- }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, _Extent * sizeof(element_type)> __as_writable_bytes() const noexcept {
- return span<byte, _Extent * sizeof(element_type)>{reinterpret_cast<byte*>(data()), size_bytes()};
- }
-
-private:
- pointer __data_;
-};
-
-template <typename _Tp>
-class _LIBCPP_TEMPLATE_VIS span<_Tp, dynamic_extent> {
-public:
- // constants and types
- using element_type = _Tp;
- using value_type = remove_cv_t<_Tp>;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- using pointer = _Tp*;
- using const_pointer = const _Tp*;
- using reference = _Tp&;
- using const_reference = const _Tp&;
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- using iterator = __bounded_iter<pointer>;
-# else
- using iterator = __wrap_iter<pointer>;
-# endif
- using reverse_iterator = std::reverse_iterator<iterator>;
-
- static constexpr size_type extent = dynamic_extent;
-
- // [span.cons], span constructors, copy, assignment, and destructor
- _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
-
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il)
- requires is_const_v<element_type>
- : __data_{__il.begin()}, __size_{__il.size()} {}
-# endif
-
- constexpr span(const span&) noexcept = default;
- constexpr span& operator=(const span&) noexcept = default;
-
- template <__span_compatible_iterator<element_type> _It>
- _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
- : __data_{std::to_address(__first)}, __size_{__count} {}
-
- template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, _End __last)
- : __data_(std::to_address(__first)), __size_(__last - __first) {
- _LIBCPP_ASSERT_VALID_INPUT_RANGE(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
- }
-
- template <size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI constexpr span(type_identity_t<element_type> (&__arr)[_Sz]) noexcept
- : __data_{__arr}, __size_{_Sz} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _Sz>
- _LIBCPP_HIDE_FROM_ABI constexpr span(array<_OtherElementType, _Sz>& __arr) noexcept
- : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <class _OtherElementType, size_t _Sz>
- requires __span_array_convertible<const _OtherElementType, element_type>
- _LIBCPP_HIDE_FROM_ABI constexpr span(const array<_OtherElementType, _Sz>& __arr) noexcept
- : __data_{__arr.data()}, __size_{_Sz} {}
-
- template <__span_compatible_range<element_type> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr span(_Range&& __r) : __data_(ranges::data(__r)), __size_{ranges::size(__r)} {}
-
- template <__span_array_convertible<element_type> _OtherElementType, size_t _OtherExtent>
- _LIBCPP_HIDE_FROM_ABI constexpr span(const span<_OtherElementType, _OtherExtent>& __other) noexcept
- : __data_{__other.data()}, __size_{__other.size()} {}
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> first() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::first<Count>(): Count out of range");
- return span<element_type, _Count>{data(), _Count};
- }
-
- template <size_t _Count>
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> last() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count <= size(), "span<T>::last<Count>(): Count out of range");
- return span<element_type, _Count>{data() + size() - _Count, _Count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::first(count): count out of range");
- return {data(), __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count <= size(), "span<T>::last(count): count out of range");
- return {data() + size() - __count, __count};
- }
-
- template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI constexpr span<element_type, _Count> subspan() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(_Count == dynamic_extent || _Count <= size() - _Offset,
- "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
- return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
- }
-
- constexpr span<element_type, dynamic_extent> _LIBCPP_HIDE_FROM_ABI
- subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
- if (__count == dynamic_extent)
- return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
- __count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
- return {data() + __offset, __count};
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { return __size_; }
- _LIBCPP_HIDE_FROM_ABI constexpr size_type size_bytes() const noexcept { return __size_ * sizeof(element_type); }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const noexcept { return __size_ == 0; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](size_type __idx) const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < size(), "span<T>::operator[](index): index out of range");
- return __data_[__idx];
- }
-
-# if _LIBCPP_STD_VER >= 26
- _LIBCPP_HIDE_FROM_ABI constexpr reference at(size_type __index) const {
- if (__index >= size())
- std::__throw_out_of_range("span");
- return __data_[__index];
- }
-# endif
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference front() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::front() on empty span");
- return __data_[0];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr reference back() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "span<T>::back() on empty span");
- return __data_[size() - 1];
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer data() const noexcept { return __data_; }
-
- // [span.iter], span iterator support
- _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() const noexcept {
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data(), data(), data() + size());
-# else
- return iterator(data());
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr iterator end() const noexcept {
-# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
- return std::__make_bounded_iter(data() + size(), data(), data() + size());
-# else
- return iterator(data() + size());
-# endif
- }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
- _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }
-
- _LIBCPP_HIDE_FROM_ABI span<const byte, dynamic_extent> __as_bytes() const noexcept {
- return {reinterpret_cast<const byte*>(data()), size_bytes()};
- }
-
- _LIBCPP_HIDE_FROM_ABI span<byte, dynamic_extent> __as_writable_bytes() const noexcept {
- return {reinterpret_cast<byte*>(data()), size_bytes()};
- }
-
-private:
- pointer __data_;
- size_type __size_;
-};
-
-template <class _Tp, size_t _Extent>
-inline constexpr bool ranges::enable_borrowed_range<span<_Tp, _Extent> > = true;
-
-template <class _ElementType, size_t _Extent>
-inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
-
-// as_bytes & as_writable_bytes
-template <class _Tp, size_t _Extent>
-_LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
- return __s.__as_bytes();
-}
-
-template <class _Tp, size_t _Extent>
- requires(!is_const_v<_Tp>)
-_LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
- return __s.__as_writable_bytes();
-}
-
-# if _LIBCPP_STD_VER >= 26
-template <class _Tp>
-concept __integral_constant_like =
- is_integral_v<decltype(_Tp::value)> && !is_same_v<bool, remove_const_t<decltype(_Tp::value)>> &&
- convertible_to<_Tp, decltype(_Tp::value)> && equality_comparable_with<_Tp, decltype(_Tp::value)> &&
- bool_constant<_Tp() == _Tp::value>::value &&
- bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == _Tp::value>::value;
-
-template <class _Tp>
-inline constexpr size_t __maybe_static_ext = dynamic_extent;
-
-template <__integral_constant_like _Tp>
-inline constexpr size_t __maybe_static_ext<_Tp> = {_Tp::value};
-
-template <contiguous_iterator _It, class _EndOrSize>
-span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>, __maybe_static_ext<_EndOrSize>>;
-# else
-template <contiguous_iterator _It, class _EndOrSize>
-span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
-# endif
-
-template <class _Tp, size_t _Sz>
-span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
-
-template <class _Tp, size_t _Sz>
-span(array<_Tp, _Sz>&) -> span<_Tp, _Sz>;
-
-template <class _Tp, size_t _Sz>
-span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
-
-template <ranges::contiguous_range _Range>
-span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
-
-#endif // _LIBCPP_STD_VER >= 20
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/array>
-# include <__cxx03/concepts>
-# include <__cxx03/functional>
-# include <__cxx03/iterator>
-# include <__cxx03/type_traits>
-#endif
-
-#endif // _LIBCPP___CXX03_SPAN
diff --git a/libcxx/include/__cxx03/stack b/libcxx/include/__cxx03/stack
index e4988362b8010..f831bc3eb88c7 100644
--- a/libcxx/include/__cxx03/stack
+++ b/libcxx/include/__cxx03/stack
@@ -113,27 +113,16 @@ template <class T, class Container>
*/
-#include <__cxx03/__algorithm/ranges_copy.h>
#include <__cxx03/__config>
#include <__cxx03/__fwd/stack.h>
#include <__cxx03/__iterator/back_insert_iterator.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__memory/uses_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__type_traits/is_same.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/deque>
#include <__cxx03/version>
-// standard-mandated includes
-
-// [stack.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -371,7 +360,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/functional>
# include <__cxx03/type_traits>
#endif
diff --git a/libcxx/include/__cxx03/stop_token b/libcxx/include/__cxx03/stop_token
deleted file mode 100644
index 369934d7ec6ea..0000000000000
--- a/libcxx/include/__cxx03/stop_token
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_STOP_TOKEN
-#define _LIBCPP___CXX03_STOP_TOKEN
-
-/*
-
-namespace std {
- // [stoptoken], class stop_token
- class stop_token;
-
- // [stopsource], class stop_source
- class stop_source;
-
- // no-shared-stop-state indicator
- struct nostopstate_t {
- explicit nostopstate_t() = default;
- };
- inline constexpr nostopstate_t nostopstate{};
-
- // [stopcallback], class template stop_callback
- template<class Callback>
- class stop_callback;
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-
-# if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__stop_token/stop_callback.h>
-# include <__cxx03/__stop_token/stop_source.h>
-# include <__cxx03/__stop_token/stop_token.h>
-# endif
-
-# include <__cxx03/version>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-#endif // !defined(_LIBCPP_HAS_NO_THREADS)
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/iosfwd>
-#endif
-
-#endif // _LIBCPP___CXX03_STOP_TOKEN
diff --git a/libcxx/include/__cxx03/string b/libcxx/include/__cxx03/string
index c4431dcb04d41..659b04730bf0a 100644
--- a/libcxx/include/__cxx03/string
+++ b/libcxx/include/__cxx03/string
@@ -593,7 +593,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
#include <__cxx03/__assert>
#include <__cxx03/__config>
#include <__cxx03/__debug_utils/sanitizers.h>
-#include <__cxx03/__format/enable_insertable.h>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/unary_function.h>
#include <__cxx03/__fwd/string.h>
@@ -611,12 +610,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
#include <__cxx03/__memory/construct_at.h>
#include <__cxx03/__memory/pointer_traits.h>
#include <__cxx03/__memory/swap_allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/size.h>
#include <__cxx03/__string/char_traits.h>
#include <__cxx03/__string/extern_template_lists.h>
#include <__cxx03/__type_traits/conditional.h>
@@ -655,14 +648,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [string.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -4340,7 +4325,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iterator>
# include <__cxx03/new>
diff --git a/libcxx/include/__cxx03/string_view b/libcxx/include/__cxx03/string_view
index c6876ab5f4446..7a32b45a0f132 100644
--- a/libcxx/include/__cxx03/string_view
+++ b/libcxx/include/__cxx03/string_view
@@ -213,16 +213,10 @@ namespace std {
#include <__cxx03/__fwd/ostream.h>
#include <__cxx03/__fwd/string_view.h>
#include <__cxx03/__iterator/bounded_iter.h>
-#include <__cxx03/__iterator/concepts.h>
#include <__cxx03/__iterator/iterator_traits.h>
#include <__cxx03/__iterator/reverse_iterator.h>
#include <__cxx03/__iterator/wrap_iter.h>
#include <__cxx03/__memory/pointer_traits.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/data.h>
-#include <__cxx03/__ranges/enable_borrowed_range.h>
-#include <__cxx03/__ranges/enable_view.h>
-#include <__cxx03/__ranges/size.h>
#include <__cxx03/__string/char_traits.h>
#include <__cxx03/__type_traits/is_array.h>
#include <__cxx03/__type_traits/is_convertible.h>
@@ -242,13 +236,6 @@ namespace std {
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [string.view.synop]
-#include <__cxx03/compare>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -939,7 +926,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iterator>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/syncstream b/libcxx/include/__cxx03/syncstream
deleted file mode 100644
index 7aacdc6c05fd4..0000000000000
--- a/libcxx/include/__cxx03/syncstream
+++ /dev/null
@@ -1,512 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_SYNCSTREAM
-#define _LIBCPP___CXX03_SYNCSTREAM
-
-/*
- syncstream synopsis
-
-#include <__cxx03/ostream> // see [ostream.syn]
-
-namespace std {
- template<class charT, class traits, class Allocator>
- class basic_syncbuf;
-
- // [syncstream.syncbuf.special], specialized algorithms
- template<class charT, class traits, class Allocator>
- void swap(basic_syncbuf<charT, traits, Allocator>&,
- basic_syncbuf<charT, traits, Allocator>&);
-
- using syncbuf = basic_syncbuf<char>;
- using wsyncbuf = basic_syncbuf<wchar_t>;
-
- template<class charT, class traits, class Allocator>
- class basic_osyncstream;
-
- using osyncstream = basic_osyncstream<char>;
- using wosyncstream = basic_osyncstream<wchar_t>;
-
- template<class charT, class traits, class Allocator>
- class basic_syncbuf : public basic_streambuf<charT, traits> {
- public:
- using char_type = charT;
- using int_type = typename traits::int_type;
- using pos_type = typename traits::pos_type;
- using off_type = typename traits::off_type;
- using traits_type = traits;
- using allocator_type = Allocator;
-
- using streambuf_type = basic_streambuf<charT, traits>;
-
- // [syncstream.syncbuf.cons], construction and destruction
- explicit basic_syncbuf(streambuf_type* obuf = nullptr)
- : basic_syncbuf(obuf, Allocator()) {}
- basic_syncbuf(streambuf_type*, const Allocator&);
- basic_syncbuf(basic_syncbuf&&);
- ~basic_syncbuf();
-
- // [syncstream.syncbuf.assign], assignment and swap
- basic_syncbuf& operator=(basic_syncbuf&&);
- void swap(basic_syncbuf&);
-
- // [syncstream.syncbuf.members], member functions
- bool emit();
- streambuf_type* get_wrapped() const noexcept;
- allocator_type get_allocator() const noexcept;
- void set_emit_on_sync(bool) noexcept;
-
- protected:
- // [syncstream.syncbuf.virtuals], overridden virtual functions
- int sync() override;
-
- private:
- streambuf_type* wrapped; // exposition only
- bool emit_on_sync{}; // exposition only
- };
-
- // [syncstream.syncbuf.special], specialized algorithms
- template<class charT, class traits, class Allocator>
- void swap(basic_syncbuf<charT, traits, Allocator>&,
- basic_syncbuf<charT, traits, Allocator>&);
-
- template<class charT, class traits, class Allocator>
- class basic_osyncstream : public basic_ostream<charT, traits> {
- public:
- using char_type = charT;
- using int_type = typename traits::int_type;
- using pos_type = typename traits::pos_type;
- using off_type = typename traits::off_type;
- using traits_type = traits;
-
- using allocator_type = Allocator;
- using streambuf_type = basic_streambuf<charT, traits>;
- using syncbuf_type = basic_syncbuf<charT, traits, Allocator>;
-
- // [syncstream.osyncstream.cons], construction and destruction
- basic_osyncstream(streambuf_type*, const Allocator&);
- explicit basic_osyncstream(streambuf_type* obuf)
- : basic_osyncstream(obuf, Allocator()) {}
- basic_osyncstream(basic_ostream<charT, traits>& os, const Allocator& allocator)
- : basic_osyncstream(os.rdbuf(), allocator) {}
- explicit basic_osyncstream(basic_ostream<charT, traits>& os)
- : basic_osyncstream(os, Allocator()) {}
- basic_osyncstream(basic_osyncstream&&) noexcept;
- ~basic_osyncstream();
-
- // [syncstream.osyncstream.assign], assignment
- basic_osyncstream& operator=(basic_osyncstream&&);
-
- // [syncstream.osyncstream.members], member functions
- void emit();
- streambuf_type* get_wrapped() const noexcept;
- syncbuf_type* rdbuf() const noexcept { return const_cast<syncbuf_type*>(addressof(sb)); }
-
- private:
- syncbuf_type sb; // exposition only
- };
-}
-
-*/
-
-#include <__cxx03/__config>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/ios>
-#include <__cxx03/iosfwd> // required for declaration of default arguments
-#include <__cxx03/streambuf>
-#include <__cxx03/string>
-
-#ifndef _LIBCPP_HAS_NO_THREADS
-# include <__cxx03/map>
-# include <__cxx03/mutex>
-# include <__cxx03/shared_mutex>
-#endif
-
-// standard-mandated includes
-
-// [syncstream.syn]
-#include <__cxx03/ostream>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
-
-// [syncstream.syncbuf.overview]/1
-// Class template basic_syncbuf stores character data written to it,
-// known as the associated output, into internal buffers allocated
-// using the object's allocator. The associated output is transferred
-// to the wrapped stream buffer object *wrapped when emit() is called
-// or when the basic_syncbuf object is destroyed. Such transfers are
-// atomic with respect to transfers by other basic_syncbuf objects
-// with the same wrapped stream buffer object.
-//
-// This helper singleton is used to implement the required
-// synchronisation guarantees.
-# ifndef _LIBCPP_HAS_NO_THREADS
-class __wrapped_streambuf_mutex {
- _LIBCPP_HIDE_FROM_ABI __wrapped_streambuf_mutex() = default;
-
-public:
- __wrapped_streambuf_mutex(const __wrapped_streambuf_mutex&) = delete;
- __wrapped_streambuf_mutex& operator=(const __wrapped_streambuf_mutex&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI void __inc_reference([[maybe_unused]] void* __ptr) {
- _LIBCPP_ASSERT_INTERNAL(__ptr != nullptr, "non-wrapped streambufs are never written to");
- unique_lock __lock{__mutex_};
- ++__lut_[reinterpret_cast<uintptr_t>(__ptr)].__count;
- }
-
- // pre: __ptr is in __lut_
- _LIBCPP_HIDE_FROM_ABI void __dec_reference([[maybe_unused]] void* __ptr) noexcept {
- unique_lock __lock{__mutex_};
-
- auto __it = __get_it(__ptr);
- if (__it->second.__count == 1)
- __lut_.erase(__it);
- else
- --__it->second.__count;
- }
-
- // TODO
- // This function causes emit() aquire two mutexes:
- // - __mutex_ shared
- // _ __get_it(__ptr)->second.__mutex exclusive
- //
- // Instead store a pointer to __get_it(__ptr)->second.__mutex when
- // calling __inc_reference.
- //
- // pre: __ptr is in __lut_
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard<mutex> __get_lock([[maybe_unused]] void* __ptr) noexcept {
- shared_lock __lock{__mutex_};
- return lock_guard{__get_it(__ptr)->second.__mutex};
- }
-
- // This function is used for testing.
- //
- // It is allowed to call this function with a non-registered pointer.
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __get_count([[maybe_unused]] void* __ptr) noexcept {
- _LIBCPP_ASSERT_INTERNAL(__ptr != nullptr, "non-wrapped streambufs are never written to");
- shared_lock __lock{__mutex_};
-
- auto __it = __lut_.find(reinterpret_cast<uintptr_t>(__ptr));
- return __it != __lut_.end() ? __it->second.__count : 0;
- }
-
- [[nodiscard]] static _LIBCPP_HIDE_FROM_ABI __wrapped_streambuf_mutex& __instance() noexcept {
- static __wrapped_streambuf_mutex __result;
- return __result;
- }
-
-private:
- struct __value {
- mutex __mutex;
- size_t __count{0};
- };
-
- shared_mutex __mutex_;
- map<uintptr_t, __value> __lut_;
-
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI map<uintptr_t, __value>::iterator __get_it(void* __ptr) noexcept {
- _LIBCPP_ASSERT_INTERNAL(__ptr != nullptr, "non-wrapped streambufs are never written to");
-
- auto __it = __lut_.find(reinterpret_cast<uintptr_t>(__ptr));
- _LIBCPP_ASSERT_INTERNAL(__it != __lut_.end(), "using a wrapped streambuf that has not been registered");
- _LIBCPP_ASSERT_INTERNAL(__it->second.__count >= 1, "found an inactive streambuf wrapper");
- return __it;
- }
-};
-# endif // _LIBCPP_HAS_NO_THREADS
-
-// basic_syncbuf
-
-// The class uses a basic_string<_CharT, _Traits, _Allocator> as
-// internal buffer. Per [syncstream.syncbuf.cons]/4
-// Remarks: A copy of allocator is used to allocate memory for
-// internal buffers holding the associated output.
-//
-// Therefore the allocator used in the constructor is passed to the
-// basic_string. The class does not keep a copy of this allocator.
-template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_syncbuf : public basic_streambuf<_CharT, _Traits> {
-public:
- using char_type = _CharT;
- using traits_type = _Traits;
- using int_type = typename traits_type::int_type;
- using pos_type = typename traits_type::pos_type;
- using off_type = typename traits_type::off_type;
- using allocator_type = _Allocator;
-
- using streambuf_type = basic_streambuf<_CharT, _Traits>;
-
- // [syncstream.syncbuf.cons], construction and destruction
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_syncbuf(streambuf_type* __obuf = nullptr)
- : basic_syncbuf(__obuf, _Allocator()) {}
-
- _LIBCPP_HIDE_FROM_ABI basic_syncbuf(streambuf_type* __obuf, _Allocator const& __alloc)
- : __wrapped_(__obuf), __str_(__alloc) {
- __inc_reference();
- }
-
- _LIBCPP_HIDE_FROM_ABI basic_syncbuf(basic_syncbuf&& __other)
- : __wrapped_(__other.get_wrapped()), __str_(std::move(__other.__str_)), __emit_on_sync_(__other.__emit_on_sync_) {
- __move_common(__other);
- }
-
- _LIBCPP_HIDE_FROM_ABI ~basic_syncbuf() {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- emit();
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- }
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
- __dec_reference();
- }
-
- // [syncstream.syncbuf.assign], assignment and swap
-
- _LIBCPP_HIDE_FROM_ABI basic_syncbuf& operator=(basic_syncbuf&& __other) {
- // The function is specified to call emit. This call should
- // propagate the exception thrown.
- emit();
- __dec_reference();
-
- __wrapped_ = __other.get_wrapped();
- __str_ = std::move(__other.__str_);
- __emit_on_sync_ = __other.__emit_on_sync_;
-
- __move_common(__other);
-
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI void swap(basic_syncbuf& __other) {
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- allocator_traits<_Allocator>::propagate_on_container_swap::value || get_allocator() == __other.get_allocator(),
- "violates the mandated swap precondition");
-
- basic_syncbuf __tmp(std::move(__other));
- __other = std::move(*this);
- *this = std::move(__tmp);
- }
-
- // [syncstream.syncbuf.members], member functions
-
- _LIBCPP_HIDE_FROM_ABI bool emit() { return emit(false); }
-
- _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __wrapped_; }
-
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const noexcept { return __str_.get_allocator(); }
-
- _LIBCPP_HIDE_FROM_ABI void set_emit_on_sync(bool __b) noexcept { __emit_on_sync_ = __b; }
-
-protected:
- // [syncstream.syncbuf.virtuals], overridden virtual functions
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- int sync() override {
- if (__emit_on_sync_ && !emit(true))
- return -1;
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL
- int_type overflow(int_type __c = traits_type::eof()) override {
- if (traits_type::eq_int_type(__c, traits_type::eof()))
- return traits_type::not_eof(__c);
-
- if (this->pptr() == this->epptr()) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-# endif
- size_t __size = __str_.size();
- __str_.resize(__str_.capacity() + 1);
- _LIBCPP_ASSERT_INTERNAL(__str_.size() > __size, "the buffer hasn't grown");
-
- char_type* __p = static_cast<char_type*>(__str_.data());
- this->setp(__p, __p + __str_.size());
- this->pbump(__size);
-
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- return traits_type::eof();
- }
-# endif
- }
-
- return this->sputc(traits_type::to_char_type(__c));
- }
-
-private:
- streambuf_type* __wrapped_;
-
- // TODO Use a more generic buffer.
- // That buffer should be light with almost no additional headers. Then
- // it can be use here, the __retarget_buffer, and place that use
- // the now deprecated get_temporary_buffer
-
- basic_string<_CharT, _Traits, _Allocator> __str_;
- bool __emit_on_sync_{false};
-
- _LIBCPP_HIDE_FROM_ABI bool emit(bool __flush) {
- if (!__wrapped_)
- return false;
-
-# ifndef _LIBCPP_HAS_NO_THREADS
- lock_guard<mutex> __lock = __wrapped_streambuf_mutex::__instance().__get_lock(__wrapped_);
-# endif
-
- bool __result = true;
- if (this->pptr() != this->pbase()) {
- _LIBCPP_ASSERT_INTERNAL(this->pbase() && this->pptr() && this->epptr(), "all put area pointers shold be valid");
-
- // The __str_ does not know how much of its buffer is used. This
- // information is extracted from the information of the base class.
- __result &= (__wrapped_->sputn(this->pbase(), this->pptr() - this->pbase()) != -1);
- // Clears the buffer, but keeps the contents (and) size of the
- // internal buffer.
- this->setp(this->pbase(), this->epptr());
- }
-
- if (__flush)
- __result &= (__wrapped_->pubsync() != -1);
-
- return __result;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __move_common(basic_syncbuf& __other) {
- // Adjust the put area pointers to our buffer.
- char_type* __p = static_cast<char_type*>(__str_.data());
- this->setp(__p, __p + __str_.size());
- this->pbump(__other.pptr() - __other.pbase());
-
- // Clear __other_ so the destructor will act as a NOP.
- __other.setp(nullptr, nullptr);
- __other.__wrapped_ = nullptr;
- }
-
- _LIBCPP_HIDE_FROM_ABI void __inc_reference() {
-# ifndef _LIBCPP_HAS_NO_THREADS
- if (__wrapped_)
- __wrapped_streambuf_mutex::__instance().__inc_reference(__wrapped_);
-# endif
- }
-
- _LIBCPP_HIDE_FROM_ABI void __dec_reference() noexcept {
-# ifndef _LIBCPP_HAS_NO_THREADS
- if (__wrapped_)
- __wrapped_streambuf_mutex::__instance().__dec_reference(__wrapped_);
-# endif
- }
-};
-
-using std::syncbuf;
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using std::wsyncbuf;
-# endif
-
-// [syncstream.syncbuf.special], specialized algorithms
-template <class _CharT, class _Traits, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI void
-swap(basic_syncbuf<_CharT, _Traits, _Allocator>& __lhs, basic_syncbuf<_CharT, _Traits, _Allocator>& __rhs) {
- __lhs.swap(__rhs);
-}
-
-// basic_osyncstream
-
-template <class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TEMPLATE_VIS basic_osyncstream : public basic_ostream<_CharT, _Traits> {
-public:
- using char_type = _CharT;
- using traits_type = _Traits;
- using int_type = typename traits_type::int_type;
- using pos_type = typename traits_type::pos_type;
- using off_type = typename traits_type::off_type;
-
- using allocator_type = _Allocator;
- using streambuf_type = basic_streambuf<char_type, traits_type>;
- using syncbuf_type = basic_syncbuf<char_type, traits_type, allocator_type>;
-
- // [syncstream.osyncstream.cons], construction and destruction
-
- _LIBCPP_HIDE_FROM_ABI basic_osyncstream(streambuf_type* __obuf, allocator_type const& __alloc)
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(__obuf, __alloc) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_osyncstream(streambuf_type* __obuf)
- : basic_osyncstream(__obuf, allocator_type()) {}
-
- _LIBCPP_HIDE_FROM_ABI basic_osyncstream(basic_ostream<char_type, traits_type>& __os, allocator_type const& __alloc)
- : basic_osyncstream(__os.rdbuf(), __alloc) {}
-
- _LIBCPP_HIDE_FROM_ABI explicit basic_osyncstream(basic_ostream<char_type, traits_type>& __os)
- : basic_osyncstream(__os, allocator_type()) {}
-
- _LIBCPP_HIDE_FROM_ABI basic_osyncstream(basic_osyncstream&& __other) noexcept
- : basic_ostream<_CharT, _Traits>(std::addressof(__sb_)), __sb_(std::move(__other.__sb_)) {
- this->set_rdbuf(std::addressof(__sb_));
- }
-
- // [syncstream.osyncstream.assign], assignment
-
- _LIBCPP_HIDE_FROM_ABI basic_osyncstream& operator=(basic_osyncstream&& __other) = default;
-
- // [syncstream.osyncstream.members], member functions
-
- _LIBCPP_HIDE_FROM_ABI void emit() {
- // The basic_ostream::put places the sentry in a try
- // catch, this does not match the wording of the standard
- // [ostream.unformatted]
- // TODO validate other unformatted output functions.
- typename basic_ostream<char_type, traits_type>::sentry __s(*this);
- if (__s) {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- try {
-# endif
-
- if (__sb_.emit() == false)
- this->setstate(ios::badbit);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- } catch (...) {
- this->__set_badbit_and_consider_rethrow();
- }
-# endif
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI streambuf_type* get_wrapped() const noexcept { return __sb_.get_wrapped(); }
-
- _LIBCPP_HIDE_FROM_ABI syncbuf_type* rdbuf() const noexcept {
- return const_cast<syncbuf_type*>(std::addressof(__sb_));
- }
-
-private:
- syncbuf_type __sb_;
-};
-
-using std::osyncstream;
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-using std::wosyncstream;
-# endif
-
-#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#endif // _LIBCPP___CXX03_SYNCSTREAM
diff --git a/libcxx/include/__cxx03/system_error b/libcxx/include/__cxx03/system_error
index 8d0d55c7e567b..9baf9e34cdd45 100644
--- a/libcxx/include/__cxx03/system_error
+++ b/libcxx/include/__cxx03/system_error
@@ -152,11 +152,6 @@ template <> struct hash<std::error_condition>;
#include <__cxx03/__system_error/system_error.h>
#include <__cxx03/version>
-// standard-mandated includes
-
-// [system.error.syn]
-#include <__cxx03/compare>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/__cxx03/thread b/libcxx/include/__cxx03/thread
index 8034854a73829..05519a43a5b4c 100644
--- a/libcxx/include/__cxx03/thread
+++ b/libcxx/include/__cxx03/thread
@@ -90,18 +90,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <__cxx03/__thread/formatter.h>
-# include <__cxx03/__thread/jthread.h>
# include <__cxx03/__thread/support.h>
# include <__cxx03/__thread/this_thread.h>
# include <__cxx03/__thread/thread.h>
# include <__cxx03/version>
-// standard-mandated includes
-
-// [thread.syn]
-# include <__cxx03/compare>
-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
diff --git a/libcxx/include/__cxx03/tuple b/libcxx/include/__cxx03/tuple
deleted file mode 100644
index 3579fd7981f00..0000000000000
--- a/libcxx/include/__cxx03/tuple
+++ /dev/null
@@ -1,1419 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_TUPLE
-#define _LIBCPP___CXX03_TUPLE
-
-// clang-format off
-
-/*
- tuple synopsis
-
-namespace std
-{
-
-template <class... T>
-class tuple {
-public:
- explicit(see-below) constexpr tuple();
- explicit(see-below) tuple(const T&...); // constexpr in C++14
- template <class... U>
- explicit(see-below) tuple(U&&...); // constexpr in C++14
- tuple(const tuple&) = default;
- tuple(tuple&&) = default;
-
- template<class... UTypes>
- constexpr explicit(see-below) tuple(tuple<UTypes...>&); // C++23
- template <class... U>
- explicit(see-below) tuple(const tuple<U...>&); // constexpr in C++14
- template <class... U>
- explicit(see-below) tuple(tuple<U...>&&); // constexpr in C++14
- template<class... UTypes>
- constexpr explicit(see-below) tuple(const tuple<UTypes...>&&); // C++23
-
- template<class U1, class U2>
- constexpr explicit(see-below) tuple(pair<U1, U2>&); // iff sizeof...(Types) == 2 // C++23
- template <class U1, class U2>
- explicit(see-below) tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
- template <class U1, class U2>
- explicit(see-below) tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
- template<class U1, class U2>
- constexpr explicit(see-below) tuple(const pair<U1, U2>&&); // iff sizeof...(Types) == 2 // C++23
-
- // allocator-extended constructors
- template <class Alloc>
- tuple(allocator_arg_t, const Alloc& a);
- template <class Alloc>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const T&...); // constexpr in C++20
- template <class Alloc, class... U>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, U&&...); // constexpr in C++20
- template <class Alloc>
- tuple(allocator_arg_t, const Alloc& a, const tuple&); // constexpr in C++20
- template <class Alloc>
- tuple(allocator_arg_t, const Alloc& a, tuple&&); // constexpr in C++20
- template<class Alloc, class... UTypes>
- constexpr explicit(see-below)
- tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&); // C++23
- template <class Alloc, class... U>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&); // constexpr in C++20
- template <class Alloc, class... U>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&); // constexpr in C++20
- template<class Alloc, class... UTypes>
- constexpr explicit(see-below)
- tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&&); // C++23
- template<class Alloc, class U1, class U2>
- constexpr explicit(see-below)
- tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&); // C++23
- template <class Alloc, class U1, class U2>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&); // constexpr in C++20
- template <class Alloc, class U1, class U2>
- explicit(see-below) tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&); // constexpr in C++20
- template<class Alloc, class U1, class U2>
- constexpr explicit(see-below)
- tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&); // C++23
-
- tuple& operator=(const tuple&); // constexpr in C++20
- constexpr const tuple& operator=(const tuple&) const; // C++23
- tuple& operator=(tuple&&) noexcept(is_nothrow_move_assignable_v<T> && ...); // constexpr in C++20
- constexpr const tuple& operator=(tuple&&) const; // C++23
- template <class... U>
- tuple& operator=(const tuple<U...>&); // constexpr in C++20
- template<class... UTypes>
- constexpr const tuple& operator=(const tuple<UTypes...>&) const; // C++23
- template <class... U>
- tuple& operator=(tuple<U...>&&); // constexpr in C++20
- template<class... UTypes>
- constexpr const tuple& operator=(tuple<UTypes...>&&) const; // C++23
- template <class U1, class U2>
- tuple& operator=(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++20
- template<class U1, class U2>
- constexpr const tuple& operator=(const pair<U1, U2>&) const; // iff sizeof...(Types) == 2 // C++23
- template <class U1, class U2>
- tuple& operator=(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++20
- template<class U1, class U2>
- constexpr const tuple& operator=(pair<U1, U2>&&) const; // iff sizeof...(Types) == 2 // C++23
-
- template<class U, size_t N>
- tuple& operator=(array<U, N> const&) // iff sizeof...(T) == N, EXTENSION
- template<class U, size_t N>
- tuple& operator=(array<U, N>&&) // iff sizeof...(T) == N, EXTENSION
-
- void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...)); // constexpr in C++20
- constexpr void swap(const tuple&) const noexcept(see-below); // C++23
-};
-
-
-template<class... TTypes, class... UTypes, template<class> class TQual, template<class> class UQual> // since C++23
- requires requires { typename tuple<common_reference_t<TQual<TTypes>, UQual<UTypes>>...>; }
-struct basic_common_reference<tuple<TTypes...>, tuple<UTypes...>, TQual, UQual> {
- using type = tuple<common_reference_t<TQual<TTypes>, UQual<UTypes>>...>;
-};
-
-template<class... TTypes, class... UTypes> // since C++23
- requires requires { typename tuple<common_type_t<TTypes, UTypes>...>; }
-struct common_type<tuple<TTypes...>, tuple<UTypes...>> {
- using type = tuple<common_type_t<TTypes, UTypes>...>;
-};
-
-template <class ...T>
-tuple(T...) -> tuple<T...>; // since C++17
-template <class T1, class T2>
-tuple(pair<T1, T2>) -> tuple<T1, T2>; // since C++17
-template <class Alloc, class ...T>
-tuple(allocator_arg_t, Alloc, T...) -> tuple<T...>; // since C++17
-template <class Alloc, class T1, class T2>
-tuple(allocator_arg_t, Alloc, pair<T1, T2>) -> tuple<T1, T2>; // since C++17
-template <class Alloc, class ...T>
-tuple(allocator_arg_t, Alloc, tuple<T...>) -> tuple<T...>; // since C++17
-
-struct ignore-type { // exposition only // Since C++26
- constexpr const ignore-type&
- operator=(const auto &) const noexcept
- { return *this; }
-};
-inline constexpr ignore-type ignore;
-
-template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
-template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14
-template <class... T> tuple<T&...> tie(T&...) noexcept; // constexpr in C++14
-template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14
-
-// [tuple.apply], calling a function with a tuple of arguments:
-template <class F, class Tuple>
- constexpr decltype(auto) apply(F&& f, Tuple&& t) noexcept(see below); // C++17 noexcept since C++23
-template <class T, class Tuple>
- constexpr T make_from_tuple(Tuple&& t); // C++17
-
-// 20.4.1.4, tuple helper classes:
-template <class T> struct tuple_size; // undefined
-template <class... T> struct tuple_size<tuple<T...>>;
-template <class T>
- inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
-template <size_t I, class T> struct tuple_element; // undefined
-template <size_t I, class... T> struct tuple_element<I, tuple<T...>>;
-template <size_t I, class T>
- using tuple_element_t = typename tuple_element <I, T>::type; // C++14
-
-// 20.4.1.5, element access:
-template <size_t I, class... T>
- typename tuple_element<I, tuple<T...>>::type&
- get(tuple<T...>&) noexcept; // constexpr in C++14
-template <size_t I, class... T>
- const typename tuple_element<I, tuple<T...>>::type&
- get(const tuple<T...>&) noexcept; // constexpr in C++14
-template <size_t I, class... T>
- typename tuple_element<I, tuple<T...>>::type&&
- get(tuple<T...>&&) noexcept; // constexpr in C++14
-template <size_t I, class... T>
- const typename tuple_element<I, tuple<T...>>::type&&
- get(const tuple<T...>&&) noexcept; // constexpr in C++14
-
-template <class T1, class... T>
- constexpr T1& get(tuple<T...>&) noexcept; // C++14
-template <class T1, class... T>
- constexpr const T1& get(const tuple<T...>&) noexcept; // C++14
-template <class T1, class... T>
- constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
-template <class T1, class... T>
- constexpr const T1&& get(const tuple<T...>&&) noexcept; // C++14
-
-// 20.4.1.6, relational operators:
-template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
-template<class... T, class... U> bool operator<(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14, removed in C++20
-template<class... T, class... U> bool operator!=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14, removed in C++20
-template<class... T, class... U> bool operator>(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14, removed in C++20
-template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14, removed in C++20
-template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14, removed in C++20
-template<class... T, class... U>
- constexpr common_comparison_category_t<synth-three-way-result<T, U>...>
- operator<=>(const tuple<T...>&, const tuple<U...>&); // since C++20
-
-template <class... Types, class Alloc>
- struct uses_allocator<tuple<Types...>, Alloc>;
-
-template <class... Types>
- void
- swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
-
-template <class... Types>
- constexpr void swap(const tuple<Types...>& x, const tuple<Types...>& y) noexcept(see-below); // C++23
-
-} // std
-
-*/
-
-// clang-format on
-
-#include <__cxx03/__compare/common_comparison_category.h>
-#include <__cxx03/__compare/synth_three_way.h>
-#include <__cxx03/__config>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__fwd/array.h>
-#include <__cxx03/__fwd/pair.h>
-#include <__cxx03/__fwd/tuple.h>
-#include <__cxx03/__memory/allocator_arg_t.h>
-#include <__cxx03/__memory/uses_allocator.h>
-#include <__cxx03/__tuple/find_index.h>
-#include <__cxx03/__tuple/ignore.h>
-#include <__cxx03/__tuple/make_tuple_types.h>
-#include <__cxx03/__tuple/sfinae_helpers.h>
-#include <__cxx03/__tuple/tuple_element.h>
-#include <__cxx03/__tuple/tuple_indices.h>
-#include <__cxx03/__tuple/tuple_like_ext.h>
-#include <__cxx03/__tuple/tuple_size.h>
-#include <__cxx03/__tuple/tuple_types.h>
-#include <__cxx03/__type_traits/common_reference.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/conditional.h>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/copy_cvref.h>
-#include <__cxx03/__type_traits/disjunction.h>
-#include <__cxx03/__type_traits/is_arithmetic.h>
-#include <__cxx03/__type_traits/is_assignable.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_convertible.h>
-#include <__cxx03/__type_traits/is_empty.h>
-#include <__cxx03/__type_traits/is_final.h>
-#include <__cxx03/__type_traits/is_implicitly_default_constructible.h>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_same.h>
-#include <__cxx03/__type_traits/is_swappable.h>
-#include <__cxx03/__type_traits/is_trivially_relocatable.h>
-#include <__cxx03/__type_traits/lazy.h>
-#include <__cxx03/__type_traits/maybe_const.h>
-#include <__cxx03/__type_traits/nat.h>
-#include <__cxx03/__type_traits/negation.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/remove_reference.h>
-#include <__cxx03/__type_traits/unwrap_ref.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/piecewise_construct.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/cstddef>
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [tuple.syn]
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#ifndef _LIBCPP_CXX03_LANG
-
-// __tuple_leaf
-
-template <size_t _Ip, class _Hp, bool = is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value >
-class __tuple_leaf;
-
-template <size_t _Ip, class _Hp, bool _Ep>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) noexcept(__is_nothrow_swappable_v<_Hp>) {
- swap(__x.get(), __y.get());
-}
-
-template <size_t _Ip, class _Hp, bool _Ep>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x,
- const __tuple_leaf<_Ip, _Hp, _Ep>& __y) noexcept(__is_nothrow_swappable_v<const _Hp>) {
- swap(__x.get(), __y.get());
-}
-
-template <size_t _Ip, class _Hp, bool>
-class __tuple_leaf {
- _Hp __value_;
-
- template <class _Tp>
- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
-# if __has_keyword(__reference_binds_to_temporary)
- return !__reference_binds_to_temporary(_Hp, _Tp);
-# else
- return true;
-# endif
- }
-
-public:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) : __value_() {
- static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
- }
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) : __value_() {
- static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
- }
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : __value_(allocator_arg_t(), __a) {
- static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
- }
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : __value_(__a) {
- static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
- }
-
- template <
- class _Tp,
- __enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) noexcept(is_nothrow_constructible<_Hp, _Tp>::value)
- : __value_(std::forward<_Tp>(__t)) {
- static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");
- }
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t)) {
- static_assert(__can_bind_reference<_Tp&&>(),
- "Attempted construction of reference element binds to a temporary whose lifetime has ended");
- }
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {
- static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
- }
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : __value_(std::forward<_Tp>(__t), __a) {
- static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
- }
-
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
- _LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int
- swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable_v<__tuple_leaf>) {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __t) const
- noexcept(__is_nothrow_swappable_v<const __tuple_leaf>) {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return __value_; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT { return __value_; }
-};
-
-template <size_t _Ip, class _Hp>
-class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
-public:
- _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : _Hp(allocator_arg_t(), __a) {}
-
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : _Hp(__a) {}
-
- template <class _Tp,
- __enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) noexcept(is_nothrow_constructible<_Hp, _Tp>::value)
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : _Hp(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {}
-
- template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : _Hp(std::forward<_Tp>(__t), __a) {}
-
- __tuple_leaf(__tuple_leaf const&) = default;
- __tuple_leaf(__tuple_leaf&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int
- swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable_v<__tuple_leaf>) {
- std::swap(*this, __t);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __rhs) const
- noexcept(__is_nothrow_swappable_v<const __tuple_leaf>) {
- std::swap(*this, __rhs);
- return 0;
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Hp& get() _NOEXCEPT { return static_cast<_Hp&>(*this); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Hp& get() const _NOEXCEPT {
- return static_cast<const _Hp&>(*this);
- }
-};
-
-template <class... _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NOEXCEPT {}
-
-template <class _Tp>
-struct __all_default_constructible;
-
-template <class... _Tp>
-struct __all_default_constructible<__tuple_types<_Tp...>> : __all<is_default_constructible<_Tp>::value...> {};
-
-// __tuple_impl
-
-template <class _Indx, class... _Tp>
-struct __tuple_impl;
-
-template <size_t... _Indx, class... _Tp>
-struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
- : public __tuple_leaf<_Indx, _Tp>... {
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl() noexcept(
- __all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
-
- template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
- __tuple_indices<_Uf...>,
- __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>,
- __tuple_types<_Tl...>,
- _Up&&... __u) noexcept(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
- __all<is_nothrow_default_constructible<_Tl>::value...>::value)
- : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
-
- template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
- allocator_arg_t,
- const _Alloc& __a,
- __tuple_indices<_Uf...>,
- __tuple_types<_Tf...>,
- __tuple_indices<_Ul...>,
- __tuple_types<_Tl...>,
- _Up&&... __u)
- : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
- __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
-
- template <class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) noexcept(
- (__all<is_nothrow_constructible<
- _Tp,
- typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
- : __tuple_leaf<_Indx, _Tp>(
- std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
- std::get<_Indx>(__t)))... {}
-
- template <class _Alloc, class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
- : __tuple_leaf<_Indx, _Tp>(
- __uses_alloc_ctor<_Tp,
- _Alloc,
- typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(),
- __a,
- std::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(
- std::get<_Indx>(__t)))... {}
-
- __tuple_impl(const __tuple_impl&) = default;
- __tuple_impl(__tuple_impl&&) = default;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
- swap(__tuple_impl& __t) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(const __tuple_impl& __t) const
- noexcept(__all<__is_nothrow_swappable_v<const _Tp>...>::value) {
- std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
- }
-};
-
-template <class _Dest, class _Source, size_t... _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
- std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
-}
-
-template <class _Dest, class _Source, class... _Up, size_t... _Np>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
- std::__swallow(((std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))), void(), 0)...);
-}
-
-template <class... _Tp>
-class _LIBCPP_TEMPLATE_VIS tuple {
- typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
-
- _BaseT __base_;
-
- template <size_t _Jp, class... _Up>
- friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class... _Up>
- friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&
- get(const tuple<_Up...>&) _NOEXCEPT;
- template <size_t _Jp, class... _Up>
- friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type&&
- get(tuple<_Up...>&&) _NOEXCEPT;
- template <size_t _Jp, class... _Up>
- friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&&
- get(const tuple<_Up...>&&) _NOEXCEPT;
-
-public:
- using __trivially_relocatable = __conditional_t<_And<__libcpp_is_trivially_relocatable<_Tp>...>::value, tuple, void>;
-
- // [tuple.cnstr]
-
- // tuple() constructors (including allocator_arg_t variants)
- template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template <class...> class _IsDefault = is_default_constructible,
- __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
- tuple() noexcept(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
-
- template <class _Alloc,
- template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
- template <class...> class _IsDefault = is_default_constructible,
- __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
- tuple(allocator_arg_t, _Alloc const& __a)
- : __base_(allocator_arg_t(),
- __a,
- __tuple_indices<>(),
- __tuple_types<>(),
- typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
- __tuple_types<_Tp...>()) {}
-
- // tuple(const T&...) constructors (including allocator_arg_t variants)
- template <template <class...> class _And = _And,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
- tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
- typename __make_tuple_indices<0>::type(),
- typename __make_tuple_types<tuple, 0>::type(),
- __t...) {}
-
- template <class _Alloc,
- template <class...> class _And = _And,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
- : __base_(allocator_arg_t(),
- __a,
- typename __make_tuple_indices<sizeof...(_Tp)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
- typename __make_tuple_indices<0>::type(),
- typename __make_tuple_types<tuple, 0>::type(),
- __t...) {}
-
- // tuple(U&& ...) constructors (including allocator_arg_t variants)
- template <class... _Up>
- struct _IsThisTuple : false_type {};
- template <class _Up>
- struct _IsThisTuple<_Up> : is_same<__remove_cvref_t<_Up>, tuple> {};
-
- template <class... _Up>
- struct _EnableUTypesCtor
- : _And< _BoolConstant<sizeof...(_Tp) >= 1>,
- _Not<_IsThisTuple<_Up...> >, // extension to allow mis-behaved user constructors
- is_constructible<_Tp, _Up>... > {};
-
- template <class... _Up,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- template <class _Alloc,
- class... _Up,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
- : __base_(allocator_arg_t(),
- __a,
- typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
- std::forward<_Up>(__u)...) {}
-
- // Copy and move constructors (including the allocator_arg_t variants)
- tuple(const tuple&) = default;
- tuple(tuple&&) = default;
-
- template <class _Alloc,
- template <class...> class _And = _And,
- __enable_if_t< _And<is_copy_constructible<_Tp>...>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple& __t)
- : __base_(allocator_arg_t(), __alloc, __t) {}
-
- template <class _Alloc,
- template <class...> class _And = _And,
- __enable_if_t< _And<is_move_constructible<_Tp>...>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc& __alloc, tuple&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
-
- // tuple(const tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class _OtherTuple, class _DecayedOtherTuple = __remove_cvref_t<_OtherTuple>, class = void>
- struct _EnableCtorFromUTypesTuple : false_type {};
-
- template <class _OtherTuple, class... _Up>
- struct _EnableCtorFromUTypesTuple<
- _OtherTuple,
- tuple<_Up...>,
- // the length of the packs needs to checked first otherwise the 2 packs cannot be expanded simultaneously below
- __enable_if_t<sizeof...(_Up) == sizeof...(_Tp)>>
- : _And<
- // the two conditions below are not in spec. The purpose is to disable the UTypes Ctor when copy/move Ctor
- // can work. Otherwise, is_constructible can trigger hard error in those cases
- // https://godbolt.org/z/M94cGdKcE
- _Not<is_same<_OtherTuple, const tuple&> >,
- _Not<is_same<_OtherTuple, tuple&&> >,
- is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
- _Lazy<_Or,
- _BoolConstant<sizeof...(_Tp) != 1>,
- // _Tp and _Up are 1-element packs - the pack expansions look
- // weird to avoid tripping up the type traits in degenerate cases
- _Lazy<_And,
- _Not<is_same<_Tp, _Up> >...,
- _Not<is_convertible<_OtherTuple, _Tp> >...,
- _Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
-
- template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
- tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)
- : __base_(__t) {}
-
- template <class... _Up,
- class _Alloc,
- __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
- : __base_(allocator_arg_t(), __a, __t) {}
-
-# if _LIBCPP_STD_VER >= 23
- // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
- : __base_(__t) {}
-
- template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t)
- : __base_(allocator_arg_t(), __alloc, __t) {}
-# endif // _LIBCPP_STD_VER >= 23
-
- // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
- template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
- : __base_(std::move(__t)) {}
-
- template <class _Alloc,
- class... _Up,
- __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __a, std::move(__t)) {}
-
-# if _LIBCPP_STD_VER >= 23
- // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
-
- template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(const tuple<_Up...>&& __t)
- : __base_(std::move(__t)) {}
-
- template <class _Alloc,
- class... _Up,
- enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
- : __base_(allocator_arg_t(), __alloc, std::move(__t)) {}
-# endif // _LIBCPP_STD_VER >= 23
-
- // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <template <class...> class _Pred,
- class _Pair,
- class _DecayedPair = __remove_cvref_t<_Pair>,
- class _Tuple = tuple>
- struct _CtorPredicateFromPair : false_type {};
-
- template <template <class...> class _Pred, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _CtorPredicateFromPair<_Pred, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
- : _And< _Pred<_Tp1, __copy_cvref_t<_Pair, _Up1> >, _Pred<_Tp2, __copy_cvref_t<_Pair, _Up2> > > {};
-
- template <class _Pair>
- struct _EnableCtorFromPair : _CtorPredicateFromPair<is_constructible, _Pair> {};
-
- template <class _Pair>
- struct _NothrowConstructibleFromPair : _CtorPredicateFromPair<is_nothrow_constructible, _Pair> {};
-
- template <class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple>
- struct _BothImplicitlyConvertible : false_type {};
-
- template <class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _BothImplicitlyConvertible<_Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
- : _And< is_convertible<__copy_cvref_t<_Pair, _Up1>, _Tp1>, is_convertible<__copy_cvref_t<_Pair, _Up2>, _Tp2> > {};
-
- template <class _Up1,
- class _Up2,
- template <class...> class _And = _And,
- __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
- tuple(const pair<_Up1, _Up2>& __p) noexcept(_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)
- : __base_(__p) {}
-
- template <class _Alloc,
- class _Up1,
- class _Up2,
- template <class...> class _And = _And,
- __enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
- : __base_(allocator_arg_t(), __a, __p) {}
-
-# if _LIBCPP_STD_VER >= 23
- // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(pair<_U1, _U2>& __p)
- : __base_(__p) {}
-
- template <class _Alloc,
- class _U1,
- class _U2,
- enable_if_t< _EnableCtorFromPair<std::pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<pair<_U1, _U2>&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, pair<_U1, _U2>& __p)
- : __base_(allocator_arg_t(), __alloc, __p) {}
-# endif
-
- // tuple(pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _Up1,
- class _Up2,
- template <class...> class _And = _And,
- __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
- tuple(pair<_Up1, _Up2>&& __p) noexcept(_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)
- : __base_(std::move(__p)) {}
-
- template <class _Alloc,
- class _Up1,
- class _Up2,
- template <class...> class _And = _And,
- __enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
- tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
- : __base_(allocator_arg_t(), __a, std::move(__p)) {}
-
-# if _LIBCPP_STD_VER >= 23
- // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants)
-
- template <class _U1, class _U2, enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(const pair<_U1, _U2>&& __p)
- : __base_(std::move(__p)) {}
-
- template <class _Alloc,
- class _U1,
- class _U2,
- enable_if_t< _EnableCtorFromPair<const pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value)
- tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p)
- : __base_(allocator_arg_t(), __alloc, std::move(__p)) {}
-# endif // _LIBCPP_STD_VER >= 23
-
- // [tuple.assign]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) noexcept(
- _And<is_nothrow_copy_assignable<_Tp>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const
- requires(_And<is_copy_assignable<const _Tp>...>::value)
- {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple&& __tuple) const
- requires(_And<is_assignable<const _Tp&, _Tp>...>::value)
- {
- std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-# endif // _LIBCPP_STD_VER >= 23
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) noexcept(
- _And<is_nothrow_move_assignable<_Tp>...>::value) {
- std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template <
- class... _Up,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(tuple<_Up...> const& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template <class... _Up,
- __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(tuple<_Up...>&& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
- std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
-# if _LIBCPP_STD_VER >= 23
- template <class... _UTypes,
- enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const tuple<_UTypes...>& __u) const {
- std::__memberwise_copy_assign(*this, __u, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- template <class... _UTypes,
- enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
- is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple<_UTypes...>&& __u) const {
- std::__memberwise_forward_assign(
- *this, __u, __tuple_types<_UTypes...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-# endif // _LIBCPP_STD_VER >= 23
-
- template <template <class...> class _Pred,
- bool _Const,
- class _Pair,
- class _DecayedPair = __remove_cvref_t<_Pair>,
- class _Tuple = tuple>
- struct _AssignPredicateFromPair : false_type {};
-
- template <template <class...> class _Pred, bool _Const, class _Pair, class _Up1, class _Up2, class _Tp1, class _Tp2>
- struct _AssignPredicateFromPair<_Pred, _Const, _Pair, pair<_Up1, _Up2>, tuple<_Tp1, _Tp2> >
- : _And<_Pred<__maybe_const<_Const, _Tp1>&, __copy_cvref_t<_Pair, _Up1> >,
- _Pred<__maybe_const<_Const, _Tp2>&, __copy_cvref_t<_Pair, _Up2> > > {};
-
- template <bool _Const, class _Pair>
- struct _EnableAssignFromPair : _AssignPredicateFromPair<is_assignable, _Const, _Pair> {};
-
- template <bool _Const, class _Pair>
- struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {};
-
-# if _LIBCPP_STD_VER >= 23
- template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const pair<_U1, _U2>& __pair) const
- noexcept(_NothrowAssignFromPair<true, const pair<_U1, _U2>&>::value) {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, pair<_U1, _U2>&&>::value>* = nullptr>
- _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(pair<_U1, _U2>&& __pair) const
- noexcept(_NothrowAssignFromPair<true, pair<_U1, _U2>&&>::value) {
- std::get<0>(*this) = std::move(__pair.first);
- std::get<1>(*this) = std::move(__pair.second);
- return *this;
- }
-# endif // _LIBCPP_STD_VER >= 23
-
- template <class _Up1,
- class _Up2,
- __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(pair<_Up1, _Up2> const& __pair) noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) {
- std::get<0>(*this) = __pair.first;
- std::get<1>(*this) = __pair.second;
- return *this;
- }
-
- template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(pair<_Up1, _Up2>&& __pair) noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) {
- std::get<0>(*this) = std::forward<_Up1>(__pair.first);
- std::get<1>(*this) = std::forward<_Up2>(__pair.second);
- return *this;
- }
-
- // EXTENSION
- template <
- class _Up,
- size_t _Np,
- __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(array<_Up, _Np> const& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
- std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // EXTENSION
- template <class _Up,
- size_t _Np,
- class = void,
- __enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
- operator=(array<_Up, _Np>&& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
- std::__memberwise_forward_assign(
- *this,
- std::move(__array),
- __tuple_types<_If<true, _Up, _Tp>...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
- return *this;
- }
-
- // [tuple.swap]
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
- swap(tuple& __t) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
- __base_.swap(__t.__base_);
- }
-
-# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple& __t) const
- noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) {
- __base_.swap(__t.__base_);
- }
-# endif // _LIBCPP_STD_VER >= 23
-};
-
-template <>
-class _LIBCPP_TEMPLATE_VIS tuple<> {
-public:
- constexpr tuple() _NOEXCEPT = default;
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
- template <class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
- template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(array<_Up, 0>) _NOEXCEPT {}
- template <class _Alloc, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple&) _NOEXCEPT {}
-# if _LIBCPP_STD_VER >= 23
- _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {}
-# endif
-};
-
-# if _LIBCPP_STD_VER >= 23
-template <class... _TTypes, class... _UTypes, template <class> class _TQual, template <class> class _UQual>
- requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; }
-struct basic_common_reference<tuple<_TTypes...>, tuple<_UTypes...>, _TQual, _UQual> {
- using type = tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>;
-};
-
-template <class... _TTypes, class... _UTypes>
- requires requires { typename tuple<common_type_t<_TTypes, _UTypes>...>; }
-struct common_type<tuple<_TTypes...>, tuple<_UTypes...>> {
- using type = tuple<common_type_t<_TTypes, _UTypes>...>;
-};
-# endif // _LIBCPP_STD_VER >= 23
-
-# if _LIBCPP_STD_VER >= 17
-template <class... _Tp>
-tuple(_Tp...) -> tuple<_Tp...>;
-template <class _Tp1, class _Tp2>
-tuple(pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class... _Tp>
-tuple(allocator_arg_t, _Alloc, _Tp...) -> tuple<_Tp...>;
-template <class _Alloc, class _Tp1, class _Tp2>
-tuple(allocator_arg_t, _Alloc, pair<_Tp1, _Tp2>) -> tuple<_Tp1, _Tp2>;
-template <class _Alloc, class... _Tp>
-tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
-# endif
-
-template <class... _Tp, __enable_if_t<__all<__is_swappable_v<_Tp>...>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
-swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
- __t.swap(__u);
-}
-
-# if _LIBCPP_STD_VER >= 23
-template <class... _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void>
-swap(const tuple<_Tp...>& __lhs,
- const tuple<_Tp...>& __rhs) noexcept(__all<is_nothrow_swappable_v<const _Tp>...>::value) {
- __lhs.swap(__rhs);
-}
-# endif
-
-// get
-
-template <size_t _Ip, class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(tuple<_Tp...>& __t) _NOEXCEPT {
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
-}
-
-template <size_t _Ip, class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(const tuple<_Tp...>& __t) _NOEXCEPT {
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
-}
-
-template <size_t _Ip, class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(tuple<_Tp...>&& __t) _NOEXCEPT {
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<type&&>(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
-}
-
-template <size_t _Ip, class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(const tuple<_Tp...>&& __t) _NOEXCEPT {
- typedef _LIBCPP_NODEBUG typename tuple_element<_Ip, tuple<_Tp...> >::type type;
- return static_cast<const type&&>(static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
-}
-
-# if _LIBCPP_STD_VER >= 14
-
-template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(tuple<_Args...>& __tup) noexcept {
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
-}
-
-template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept {
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
-}
-
-template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept {
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
-}
-
-template <class _T1, class... _Args>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept {
- return std::get<__find_exactly_one_t<_T1, _Args...>::value>(std::move(__tup));
-}
-
-# endif
-
-// tie
-
-template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT {
- return tuple<_Tp&...>(__t...);
-}
-
-template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<typename __unwrap_ref_decay<_Tp>::type...>
-make_tuple(_Tp&&... __t) {
- return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::forward<_Tp>(__t)...);
-}
-
-template <class... _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT {
- return tuple<_Tp&&...>(std::forward<_Tp>(__t)...);
-}
-
-template <size_t _Ip>
-struct __tuple_equal {
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
- return __tuple_equal<_Ip - 1>()(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
- }
-};
-
-template <>
-struct __tuple_equal<0> {
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
- return true;
- }
-};
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
-}
-
-# if _LIBCPP_STD_VER >= 20
-
-// operator<=>
-
-template <class... _Tp, class... _Up, size_t... _Is>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__tuple_compare_three_way(const tuple<_Tp...>& __x, const tuple<_Up...>& __y, index_sequence<_Is...>) {
- common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal;
- static_cast<void>(
- ((__result = std::__synth_three_way(std::get<_Is>(__x), std::get<_Is>(__y)), __result != 0) || ...));
- return __result;
-}
-
-template <class... _Tp, class... _Up>
- requires(sizeof...(_Tp) == sizeof...(_Up))
-_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>
-operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- return std::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{});
-}
-
-# else // _LIBCPP_STD_VER >= 20
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- return !(__x == __y);
-}
-
-template <size_t _Ip>
-struct __tuple_less {
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp& __x, const _Up& __y) {
- const size_t __idx = tuple_size<_Tp>::value - _Ip;
- if (std::get<__idx>(__x) < std::get<__idx>(__y))
- return true;
- if (std::get<__idx>(__y) < std::get<__idx>(__x))
- return false;
- return __tuple_less<_Ip - 1>()(__x, __y);
- }
-};
-
-template <>
-struct __tuple_less<0> {
- template <class _Tp, class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _Tp&, const _Up&) {
- return false;
- }
-};
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
- return __tuple_less<sizeof...(_Tp)>()(__x, __y);
-}
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- return __y < __x;
-}
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- return !(__x < __y);
-}
-
-template <class... _Tp, class... _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
- return !(__y < __x);
-}
-
-# endif // _LIBCPP_STD_VER >= 20
-
-// tuple_cat
-
-template <class _Tp, class _Up>
-struct __tuple_cat_type;
-
-template <class... _Ttypes, class... _Utypes>
-struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > {
- typedef _LIBCPP_NODEBUG tuple<_Ttypes..., _Utypes...> type;
-};
-
-template <class _ResultTuple, bool _Is_Tuple0TupleLike, class... _Tuples>
-struct __tuple_cat_return_1 {};
-
-template <class... _Types, class _Tuple0>
-struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> {
- using type _LIBCPP_NODEBUG =
- typename __tuple_cat_type< tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type;
-};
-
-template <class... _Types, class _Tuple0, class _Tuple1, class... _Tuples>
-struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
- : public __tuple_cat_return_1<
- typename __tuple_cat_type< tuple<_Types...>,
- typename __make_tuple_types<__remove_cvref_t<_Tuple0> >::type >::type,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple1> >::value,
- _Tuple1,
- _Tuples...> {};
-
-template <class... _Tuples>
-struct __tuple_cat_return;
-
-template <class _Tuple0, class... _Tuples>
-struct __tuple_cat_return<_Tuple0, _Tuples...>
- : public __tuple_cat_return_1<tuple<>,
- __tuple_like_ext<__libcpp_remove_reference_t<_Tuple0> >::value,
- _Tuple0,
- _Tuples...> {};
-
-template <>
-struct __tuple_cat_return<> {
- typedef _LIBCPP_NODEBUG tuple<> type;
-};
-
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 tuple<> tuple_cat() { return tuple<>(); }
-
-template <class _Rp, class _Indices, class _Tuple0, class... _Tuples>
-struct __tuple_cat_return_ref_imp;
-
-template <class... _Types, size_t... _I0, class _Tuple0>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
-};
-
-template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
- : public __tuple_cat_return_ref_imp<
- tuple<_Types...,
- __copy_cvref_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
- typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
- _Tuple1,
- _Tuples...> {};
-
-template <class _Tuple0, class... _Tuples>
-struct __tuple_cat_return_ref
- : public __tuple_cat_return_ref_imp<
- tuple<>,
- typename __make_tuple_indices< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >::type,
- _Tuple0,
- _Tuples...> {};
-
-template <class _Types, class _I0, class _J0>
-struct __tuple_cat;
-
-template <class... _Types, size_t... _I0, size_t... _J0>
-struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
- template <class _Tuple0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0) {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- return std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...);
- }
-
- template <class _Tuple0, class _Tuple1, class... _Tuples>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&&... __tpls) {
- (void)__t; // avoid unused parameter warning on GCC when _I0 is empty
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
- return __tuple_cat<tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
- typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
- typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
- std::forward_as_tuple(
- std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...),
- std::forward<_Tuple1>(__t1),
- std::forward<_Tuples>(__tpls)...);
- }
-};
-
-template <class _Tuple0, class... _Tuples>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_return<_Tuple0, _Tuples...>::type
-tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
- return __tuple_cat<tuple<>, __tuple_indices<>, typename __make_tuple_indices<tuple_size<_T0>::value>::type>()(
- tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...);
-}
-
-template <class... _Tp, class _Alloc>
-struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
-
-# if _LIBCPP_STD_VER >= 17
-# define _LIBCPP_NOEXCEPT_RETURN(...) \
- noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }
-
-// The _LIBCPP_NOEXCEPT_RETURN macro breaks formatting.
-// clang-format off
-template <class _Fn, class _Tuple, size_t... _Id>
-inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
-__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
- _LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
-
-template <class _Fn, class _Tuple>
-inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&& __t)
- _LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(
- std::forward<_Fn>(__f),
- std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
-
-#if _LIBCPP_STD_VER >= 20
-template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
- noexcept(noexcept(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)))
- requires is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...> {
- return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...);
-}
-#else
-template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>,
- enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...>> * = nullptr)
- _LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
-#endif // _LIBCPP_STD_VER >= 20
-
-template <class _Tp, class _Tuple,
- class _Seq = typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type, class = void>
-inline constexpr bool __can_make_from_tuple = false;
-
-template <class _Tp, class _Tuple, size_t... _Idx>
-inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, __tuple_indices<_Idx...>,
- enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::declval<_Tuple>()))...>>> = true;
-
-// Based on LWG3528(https://wg21.link/LWG3528) and http://eel.is/c++draft/description#structure.requirements-9,
-// the standard allows to impose requirements, we constraint std::make_from_tuple to make std::make_from_tuple
-// SFINAE friendly and also avoid worse diagnostic messages. We still keep the constraints of std::__make_from_tuple_impl
-// so that std::__make_from_tuple_impl will have the same advantages when used alone.
-#if _LIBCPP_STD_VER >= 20
-template <class _Tp, class _Tuple>
- requires __can_make_from_tuple<_Tp, _Tuple> // strengthen
-#else
-template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp, _Tuple>>> // strengthen
-#endif // _LIBCPP_STD_VER >= 20
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
- _LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
- std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
-# undef _LIBCPP_NOEXCEPT_RETURN
-
-# endif // _LIBCPP_STD_VER >= 17
-
-#endif // !defined(_LIBCPP_CXX03_LANG)
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-// clang-format on
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/exception>
-# include <__cxx03/iosfwd>
-# include <__cxx03/new>
-# include <__cxx03/type_traits>
-# include <__cxx03/typeinfo>
-# include <__cxx03/utility>
-#endif
-
-#endif // _LIBCPP___CXX03_TUPLE
diff --git a/libcxx/include/__cxx03/type_traits b/libcxx/include/__cxx03/type_traits
index 287f6f0d32b18..03971c6a01fc9 100644
--- a/libcxx/include/__cxx03/type_traits
+++ b/libcxx/include/__cxx03/type_traits
@@ -496,19 +496,15 @@ namespace std
#if _LIBCPP_STD_VER >= 17
# include <__cxx03/__type_traits/conjunction.h>
# include <__cxx03/__type_traits/disjunction.h>
-# include <__cxx03/__type_traits/has_unique_object_representation.h>
# include <__cxx03/__type_traits/invoke.h>
-# include <__cxx03/__type_traits/is_aggregate.h>
# include <__cxx03/__type_traits/is_swappable.h>
# include <__cxx03/__type_traits/negation.h>
# include <__cxx03/__type_traits/void_t.h>
#endif
#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__type_traits/common_reference.h>
# include <__cxx03/__type_traits/is_bounded_array.h>
# include <__cxx03/__type_traits/is_constant_evaluated.h>
-# include <__cxx03/__type_traits/is_nothrow_convertible.h>
# include <__cxx03/__type_traits/is_unbounded_array.h>
# include <__cxx03/__type_traits/type_identity.h>
# include <__cxx03/__type_traits/unwrap_ref.h>
diff --git a/libcxx/include/__cxx03/typeindex b/libcxx/include/__cxx03/typeindex
index c7587e4e23057..6544dace816a8 100644
--- a/libcxx/include/__cxx03/typeindex
+++ b/libcxx/include/__cxx03/typeindex
@@ -50,9 +50,6 @@ struct hash<type_index>
#include <__cxx03/typeinfo>
#include <__cxx03/version>
-// standard-mandated includes
-#include <__cxx03/compare>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/__cxx03/unordered_map b/libcxx/include/__cxx03/unordered_map
index 612ad02f77164..f3c5a22068808 100644
--- a/libcxx/include/__cxx03/unordered_map
+++ b/libcxx/include/__cxx03/unordered_map
@@ -592,33 +592,18 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/erase_if_container.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/ranges_iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__node_handle>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__type_traits/type_identity.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/stdexcept>
-#include <__cxx03/tuple>
#include <__cxx03/version>
// standard-mandated includes
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [unord.map.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -2531,8 +2516,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
-# include <__cxx03/bit>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iterator>
# include <__cxx03/type_traits>
diff --git a/libcxx/include/__cxx03/unordered_set b/libcxx/include/__cxx03/unordered_set
index 25e9e1f82ad32..20d5a8e0e17ce 100644
--- a/libcxx/include/__cxx03/unordered_set
+++ b/libcxx/include/__cxx03/unordered_set
@@ -534,20 +534,13 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__cxx03/__algorithm/is_permutation.h>
#include <__cxx03/__assert>
#include <__cxx03/__config>
-#include <__cxx03/__functional/is_transparent.h>
#include <__cxx03/__functional/operations.h>
#include <__cxx03/__hash_table>
#include <__cxx03/__iterator/distance.h>
#include <__cxx03/__iterator/erase_if_container.h>
#include <__cxx03/__iterator/iterator_traits.h>
-#include <__cxx03/__iterator/ranges_iterator_traits.h>
#include <__cxx03/__memory/addressof.h>
#include <__cxx03/__memory/allocator.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__node_handle>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__utility/forward.h>
#include <__cxx03/version>
@@ -556,14 +549,6 @@ template <class Value, class Hash, class Pred, class Alloc>
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [unord.set.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -1800,7 +1785,6 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/functional>
# include <__cxx03/iterator>
diff --git a/libcxx/include/__cxx03/utility b/libcxx/include/__cxx03/utility
index ac0637f6b41ee..86a6e3f78e16a 100644
--- a/libcxx/include/__cxx03/utility
+++ b/libcxx/include/__cxx03/utility
@@ -257,22 +257,10 @@ template <class T>
#include <__cxx03/__utility/swap.h>
#if _LIBCPP_STD_VER >= 14
-# include <__cxx03/__utility/exchange.h>
# include <__cxx03/__utility/integer_sequence.h>
#endif
-#if _LIBCPP_STD_VER >= 17
-# include <__cxx03/__utility/as_const.h>
-# include <__cxx03/__utility/in_place.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-# include <__cxx03/__utility/cmp.h>
-#endif
-
#if _LIBCPP_STD_VER >= 23
-# include <__cxx03/__utility/forward_like.h>
-# include <__cxx03/__utility/to_underlying.h>
# include <__cxx03/__utility/unreachable.h>
#endif
@@ -280,14 +268,6 @@ template <class T>
// standard-mandated includes
-// [utility.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
-
-// [tuple.creation]
-
-#include <__cxx03/__tuple/ignore.h>
-
// [tuple.helper]
#include <__cxx03/__tuple/tuple_element.h>
#include <__cxx03/__tuple/tuple_size.h>
diff --git a/libcxx/include/__cxx03/valarray b/libcxx/include/__cxx03/valarray
index 1070add36abc4..62f0999b77f2f 100644
--- a/libcxx/include/__cxx03/valarray
+++ b/libcxx/include/__cxx03/valarray
@@ -365,11 +365,6 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <__cxx03/new>
#include <__cxx03/version>
-// standard-mandated includes
-
-// [valarray.syn]
-#include <__cxx03/initializer_list>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -3353,7 +3348,6 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/cstring>
# include <__cxx03/functional>
diff --git a/libcxx/include/__cxx03/variant b/libcxx/include/__cxx03/variant
deleted file mode 100644
index cedc733e9b391..0000000000000
--- a/libcxx/include/__cxx03/variant
+++ /dev/null
@@ -1,1650 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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___CXX03_VARIANT
-#define _LIBCPP___CXX03_VARIANT
-
-/*
- variant synopsis
-
-namespace std {
-
- // 20.7.2, class template variant
- template <class... Types>
- class variant {
- public:
-
- // 20.7.2.1, constructors
- constexpr variant() noexcept(see below);
- constexpr variant(const variant&);
- constexpr variant(variant&&) noexcept(see below);
-
- template <class T> constexpr variant(T&&) noexcept(see below);
-
- template <class T, class... Args>
- constexpr explicit variant(in_place_type_t<T>, Args&&...);
-
- template <class T, class U, class... Args>
- constexpr explicit variant(
- in_place_type_t<T>, initializer_list<U>, Args&&...);
-
- template <size_t I, class... Args>
- constexpr explicit variant(in_place_index_t<I>, Args&&...);
-
- template <size_t I, class U, class... Args>
- constexpr explicit variant(
- in_place_index_t<I>, initializer_list<U>, Args&&...);
-
- // 20.7.2.2, destructor
- constexpr ~variant(); // constexpr since c++20
-
- // 20.7.2.3, assignment
- constexpr variant& operator=(const variant&);
- constexpr variant& operator=(variant&&) noexcept(see below);
-
- template <class T>
- constexpr variant& operator=(T&&) noexcept(see below); // constexpr since c++20
-
- // 20.7.2.4, modifiers
- template <class T, class... Args>
- constexpr T& emplace(Args&&...); // constexpr since c++20
-
- template <class T, class U, class... Args>
- constexpr T& emplace(initializer_list<U>, Args&&...); // constexpr since c++20
-
- template <size_t I, class... Args>
- constexpr variant_alternative_t<I, variant>& emplace(Args&&...); // constexpr since c++20
-
- template <size_t I, class U, class... Args>
- constexpr variant_alternative_t<I, variant>&
- emplace(initializer_list<U>, Args&&...); // constexpr since c++20
-
- // 20.7.2.5, value status
- constexpr bool valueless_by_exception() const noexcept;
- constexpr size_t index() const noexcept;
-
- // 20.7.2.6, swap
- void swap(variant&) noexcept(see below);
-
- // [variant.visit], visitation
- template<class Self, class Visitor>
- constexpr decltype(auto) visit(this Self&&, Visitor&&); // Since C++26
- template<class R, class Self, class Visitor>
- constexpr R visit(this Self&&, Visitor&&); // Since C++26
- };
-
- // 20.7.3, variant helper classes
- template <class T> struct variant_size; // undefined
-
- template <class T>
- inline constexpr size_t variant_size_v = variant_size<T>::value;
-
- template <class T> struct variant_size<const T>;
- template <class T> struct variant_size<volatile T>;
- template <class T> struct variant_size<const volatile T>;
-
- template <class... Types>
- struct variant_size<variant<Types...>>;
-
- template <size_t I, class T> struct variant_alternative; // undefined
-
- template <size_t I, class T>
- using variant_alternative_t = typename variant_alternative<I, T>::type;
-
- template <size_t I, class T> struct variant_alternative<I, const T>;
- template <size_t I, class T> struct variant_alternative<I, volatile T>;
- template <size_t I, class T> struct variant_alternative<I, const volatile T>;
-
- template <size_t I, class... Types>
- struct variant_alternative<I, variant<Types...>>;
-
- inline constexpr size_t variant_npos = -1;
-
- // 20.7.4, value access
- template <class T, class... Types>
- constexpr bool holds_alternative(const variant<Types...>&) noexcept;
-
- template <size_t I, class... Types>
- constexpr variant_alternative_t<I, variant<Types...>>&
- get(variant<Types...>&);
-
- template <size_t I, class... Types>
- constexpr variant_alternative_t<I, variant<Types...>>&&
- get(variant<Types...>&&);
-
- template <size_t I, class... Types>
- constexpr variant_alternative_t<I, variant<Types...>> const&
- get(const variant<Types...>&);
-
- template <size_t I, class... Types>
- constexpr variant_alternative_t<I, variant<Types...>> const&&
- get(const variant<Types...>&&);
-
- template <class T, class... Types>
- constexpr T& get(variant<Types...>&);
-
- template <class T, class... Types>
- constexpr T&& get(variant<Types...>&&);
-
- template <class T, class... Types>
- constexpr const T& get(const variant<Types...>&);
-
- template <class T, class... Types>
- constexpr const T&& get(const variant<Types...>&&);
-
- template <size_t I, class... Types>
- constexpr add_pointer_t<variant_alternative_t<I, variant<Types...>>>
- get_if(variant<Types...>*) noexcept;
-
- template <size_t I, class... Types>
- constexpr add_pointer_t<const variant_alternative_t<I, variant<Types...>>>
- get_if(const variant<Types...>*) noexcept;
-
- template <class T, class... Types>
- constexpr add_pointer_t<T>
- get_if(variant<Types...>*) noexcept;
-
- template <class T, class... Types>
- constexpr add_pointer_t<const T>
- get_if(const variant<Types...>*) noexcept;
-
- // 20.7.5, relational operators
- template <class... Types>
- constexpr bool operator==(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types>
- constexpr bool operator!=(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types>
- constexpr bool operator<(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types>
- constexpr bool operator>(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types>
- constexpr bool operator<=(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types>
- constexpr bool operator>=(const variant<Types...>&, const variant<Types...>&);
-
- template <class... Types> requires (three_way_comparable<Types> && ...)
- constexpr common_comparison_category_t<compare_three_way_result_t<Types>...>
- operator<=>(const variant<Types...>&, const variant<Types...>&); // since C++20
-
- // 20.7.6, visitation
- template <class Visitor, class... Variants>
- constexpr see below visit(Visitor&&, Variants&&...);
-
- template <class R, class Visitor, class... Variants>
- constexpr R visit(Visitor&&, Variants&&...); // since C++20
-
- // 20.7.7, class monostate
- struct monostate;
-
- // 20.7.8, monostate relational operators
- constexpr bool operator==(monostate, monostate) noexcept;
- constexpr bool operator!=(monostate, monostate) noexcept; // until C++20
- constexpr bool operator<(monostate, monostate) noexcept; // until C++20
- constexpr bool operator>(monostate, monostate) noexcept; // until C++20
- constexpr bool operator<=(monostate, monostate) noexcept; // until C++20
- constexpr bool operator>=(monostate, monostate) noexcept; // until C++20
- constexpr strong_ordering operator<=>(monostate, monostate) noexcept; // since C++20
-
- // 20.7.9, specialized algorithms
- template <class... Types>
- void swap(variant<Types...>&, variant<Types...>&) noexcept(see below);
-
- // 20.7.10, class bad_variant_access
- class bad_variant_access;
-
- // 20.7.11, hash support
- template <class T> struct hash;
- template <class... Types> struct hash<variant<Types...>>;
- template <> struct hash<monostate>;
-
-} // namespace std
-
-*/
-
-#include <__cxx03/__compare/common_comparison_category.h>
-#include <__cxx03/__compare/compare_three_way_result.h>
-#include <__cxx03/__compare/three_way_comparable.h>
-#include <__cxx03/__config>
-#include <__cxx03/__exception/exception.h>
-#include <__cxx03/__functional/hash.h>
-#include <__cxx03/__functional/invoke.h>
-#include <__cxx03/__functional/operations.h>
-#include <__cxx03/__functional/unary_function.h>
-#include <__cxx03/__memory/addressof.h>
-#include <__cxx03/__memory/construct_at.h>
-#include <__cxx03/__tuple/find_index.h>
-#include <__cxx03/__tuple/sfinae_helpers.h>
-#include <__cxx03/__type_traits/add_const.h>
-#include <__cxx03/__type_traits/add_cv.h>
-#include <__cxx03/__type_traits/add_pointer.h>
-#include <__cxx03/__type_traits/add_volatile.h>
-#include <__cxx03/__type_traits/common_type.h>
-#include <__cxx03/__type_traits/conjunction.h>
-#include <__cxx03/__type_traits/dependent_type.h>
-#include <__cxx03/__type_traits/is_array.h>
-#include <__cxx03/__type_traits/is_constructible.h>
-#include <__cxx03/__type_traits/is_destructible.h>
-#include <__cxx03/__type_traits/is_nothrow_assignable.h>
-#include <__cxx03/__type_traits/is_nothrow_constructible.h>
-#include <__cxx03/__type_traits/is_reference.h>
-#include <__cxx03/__type_traits/is_trivially_assignable.h>
-#include <__cxx03/__type_traits/is_trivially_constructible.h>
-#include <__cxx03/__type_traits/is_trivially_destructible.h>
-#include <__cxx03/__type_traits/is_trivially_relocatable.h>
-#include <__cxx03/__type_traits/is_void.h>
-#include <__cxx03/__type_traits/remove_const.h>
-#include <__cxx03/__type_traits/remove_cvref.h>
-#include <__cxx03/__type_traits/type_identity.h>
-#include <__cxx03/__type_traits/void_t.h>
-#include <__cxx03/__utility/declval.h>
-#include <__cxx03/__utility/forward.h>
-#include <__cxx03/__utility/forward_like.h>
-#include <__cxx03/__utility/in_place.h>
-#include <__cxx03/__utility/integer_sequence.h>
-#include <__cxx03/__utility/move.h>
-#include <__cxx03/__utility/swap.h>
-#include <__cxx03/__variant/monostate.h>
-#include <__cxx03/__verbose_abort>
-#include <__cxx03/initializer_list>
-#include <__cxx03/limits>
-#include <__cxx03/new>
-#include <__cxx03/version>
-
-// standard-mandated includes
-
-// [variant.syn]
-#include <__cxx03/compare>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
-namespace std { // explicitly not using versioning namespace
-
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception {
-public:
- const char* what() const _NOEXCEPT override;
-};
-
-} // namespace std
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER >= 17
-
-// Light N-dimensional array of function pointers. Used in place of std::array to avoid
-// adding a dependency.
-template <class _Tp, size_t _Size>
-struct __farray {
- static_assert(_Size > 0, "N-dimensional array should never be empty in std::visit");
- _Tp __buf_[_Size] = {};
-
- _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
-};
-
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
-__throw_bad_variant_access() {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- throw bad_variant_access();
-# else
- _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
-# endif
-}
-
-template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS variant;
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size;
-
-template <class _Tp>
-inline constexpr size_t variant_size_v = variant_size<_Tp>::value;
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size<const _Tp> : variant_size<_Tp> {};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size<volatile _Tp> : variant_size<_Tp> {};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_size<const volatile _Tp> : variant_size<_Tp> {};
-
-template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS variant_size<variant<_Types...>> : integral_constant<size_t, sizeof...(_Types)> {};
-
-template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative;
-
-template <size_t _Ip, class _Tp>
-using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type;
-
-template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp> : add_const<variant_alternative_t<_Ip, _Tp>> {};
-
-template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp> : add_volatile<variant_alternative_t<_Ip, _Tp>> {};
-
-template <size_t _Ip, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp> : add_cv<variant_alternative_t<_Ip, _Tp>> {};
-
-template <size_t _Ip, class... _Types>
-struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
- static_assert(_Ip < sizeof...(_Types), "Index out of bounds in std::variant_alternative<>");
- using type = __type_pack_element<_Ip, _Types...>;
-};
-
-inline constexpr size_t variant_npos = static_cast<size_t>(-1);
-
-template <size_t _NumAlternatives>
-_LIBCPP_HIDE_FROM_ABI constexpr auto __choose_index_type() {
-# ifdef _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
- if constexpr (_NumAlternatives < numeric_limits<unsigned char>::max())
- return static_cast<unsigned char>(0);
- else if constexpr (_NumAlternatives < numeric_limits<unsigned short>::max())
- return static_cast<unsigned short>(0);
- else
-# endif // _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
- return static_cast<unsigned int>(0);
-}
-
-template <size_t _NumAlts>
-using __variant_index_t = decltype(std::__choose_index_type<_NumAlts>());
-
-template <class _IndexType>
-constexpr _IndexType __variant_npos = static_cast<_IndexType>(-1);
-
-template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS variant;
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>& __as_variant(variant<_Types...>& __vs) noexcept {
- return __vs;
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>& __as_variant(const variant<_Types...>& __vs) noexcept {
- return __vs;
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr variant<_Types...>&& __as_variant(variant<_Types...>&& __vs) noexcept {
- return std::move(__vs);
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr const variant<_Types...>&& __as_variant(const variant<_Types...>&& __vs) noexcept {
- return std::move(__vs);
-}
-
-namespace __find_detail {
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr size_t __find_index() {
- constexpr bool __matches[] = {is_same_v<_Tp, _Types>...};
- size_t __result = __not_found;
- for (size_t __i = 0; __i < sizeof...(_Types); ++__i) {
- if (__matches[__i]) {
- if (__result != __not_found) {
- return __ambiguous;
- }
- __result = __i;
- }
- }
- return __result;
-}
-
-template <size_t _Index>
-struct __find_unambiguous_index_sfinae_impl : integral_constant<size_t, _Index> {};
-
-template <>
-struct __find_unambiguous_index_sfinae_impl<__not_found> {};
-
-template <>
-struct __find_unambiguous_index_sfinae_impl<__ambiguous> {};
-
-template <class _Tp, class... _Types>
-struct __find_unambiguous_index_sfinae : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {};
-
-} // namespace __find_detail
-
-namespace __variant_detail {
-
-struct __valueless_t {};
-
-enum class _Trait { _TriviallyAvailable, _Available, _Unavailable };
-
-template <typename _Tp, template <typename> class _IsTriviallyAvailable, template <typename> class _IsAvailable>
-constexpr _Trait __trait =
- _IsTriviallyAvailable<_Tp>::value ? _Trait::_TriviallyAvailable
- : _IsAvailable<_Tp>::value
- ? _Trait::_Available
- : _Trait::_Unavailable;
-
-_LIBCPP_HIDE_FROM_ABI constexpr _Trait __common_trait(initializer_list<_Trait> __traits) {
- _Trait __result = _Trait::_TriviallyAvailable;
- for (_Trait __t : __traits) {
- if (static_cast<int>(__t) > static_cast<int>(__result)) {
- __result = __t;
- }
- }
- return __result;
-}
-
-template <typename... _Types>
-struct __traits {
- static constexpr _Trait __copy_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types, is_trivially_copy_constructible, is_copy_constructible>...});
-
- static constexpr _Trait __move_constructible_trait =
- __variant_detail::__common_trait({__trait<_Types, is_trivially_move_constructible, is_move_constructible>...});
-
- static constexpr _Trait __copy_assignable_trait = __variant_detail::__common_trait(
- {__copy_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...});
-
- static constexpr _Trait __move_assignable_trait = __variant_detail::__common_trait(
- {__move_constructible_trait, __trait<_Types, is_trivially_move_assignable, is_move_assignable>...});
-
- static constexpr _Trait __destructible_trait =
- __variant_detail::__common_trait({__trait<_Types, is_trivially_destructible, is_destructible>...});
-};
-
-namespace __access {
-
-struct __union {
- template <class _Vp>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) {
- return std::forward<_Vp>(__v).__head;
- }
-
- template <class _Vp, size_t _Ip>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) {
- return __get_alt(std::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>);
- }
-};
-
-struct __base {
- template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
- return __union::__get_alt(std::forward<_Vp>(__v).__data, in_place_index<_Ip>);
- }
-};
-
-struct __variant {
- template <size_t _Ip, class _Vp>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto&& __get_alt(_Vp&& __v) {
- return __base::__get_alt<_Ip>(std::forward<_Vp>(__v).__impl_);
- }
-};
-
-} // namespace __access
-
-namespace __visitation {
-
-struct __base {
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
- __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- constexpr auto __fdiagonal = __make_fdiagonal<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __fdiagonal[__index](std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
- }
-
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
- constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(std::forward<_Vs>(__vs).__as_base())...>();
- return __at(__fmatrix, __vs.index()...)(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__as_base()...);
- }
-
-private:
- template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI static constexpr const _Tp& __at(const _Tp& __elem) {
- return __elem;
- }
-
- template <class _Tp, size_t _Np, typename... _Indices>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto&&
- __at(const __farray<_Tp, _Np>& __elems, size_t __index, _Indices... __indices) {
- return __at(__elems[__index], __indices...);
- }
-
- template <class _Fp, class... _Fs>
- static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_visitor_return_type_check() {
- static_assert(
- __all<is_same_v<_Fp, _Fs>...>::value, "`std::visit` requires the visitor to have a single return type.");
- }
-
- template <class... _Fs>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_farray(_Fs&&... __fs) {
- __std_visit_visitor_return_type_check<__remove_cvref_t<_Fs>...>();
- using __result = __farray<common_type_t<__remove_cvref_t<_Fs>...>, sizeof...(_Fs)>;
- return __result{{std::forward<_Fs>(__fs)...}};
- }
-
- template <size_t... _Is>
- struct __dispatcher {
- template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
- return std::__invoke(static_cast<_Fp>(__f), __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
- }
- };
-
- template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_dispatch(index_sequence<_Is...>) {
- return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
- }
-
- template <size_t _Ip, class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() {
- return __make_dispatch<_Fp, _Vs...>(index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
- }
-
- template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) {
- return __base::__make_farray(__make_fdiagonal_impl<_Is, _Fp, _Vs...>()...);
- }
-
- template <class _Fp, class _Vp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal() {
- constexpr size_t __np = __remove_cvref_t<_Vp>::__size();
- static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value);
- return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{});
- }
-
- template <class _Fp, class... _Vs, size_t... _Is>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) {
- return __make_dispatch<_Fp, _Vs...>(__is);
- }
-
- template <class _Fp, class... _Vs, size_t... _Is, size_t... _Js, class... _Ls>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __make_fmatrix_impl(index_sequence<_Is...>, index_sequence<_Js...>, _Ls... __ls) {
- return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>(index_sequence<_Is..., _Js>{}, __ls...)...);
- }
-
- template <class _Fp, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fmatrix() {
- return __make_fmatrix_impl<_Fp, _Vs...>(
- index_sequence<>{}, make_index_sequence<__remove_cvref_t<_Vs>::__size()>{}...);
- }
-};
-
-struct __variant {
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
- __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __base::__visit_alt_at(__index, std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs).__impl_...);
- }
-
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) {
- return __base::__visit_alt(
- std::forward<_Visitor>(__visitor), std::__as_variant(std::forward<_Vs>(__vs)).__impl_...);
- }
-
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
- __visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) {
- return __visit_alt_at(__index, __make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
- }
-
- template <class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
- return __visit_alt(__make_value_visitor(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
- }
-
-# if _LIBCPP_STD_VER >= 20
- template <class _Rp, class _Visitor, class... _Vs>
- _LIBCPP_HIDE_FROM_ABI static constexpr _Rp __visit_value(_Visitor&& __visitor, _Vs&&... __vs) {
- return __visit_alt(__make_value_visitor<_Rp>(std::forward<_Visitor>(__visitor)), std::forward<_Vs>(__vs)...);
- }
-# endif
-
-private:
- template <class _Visitor, class... _Values>
- static _LIBCPP_HIDE_FROM_ABI constexpr void __std_visit_exhaustive_visitor_check() {
- static_assert(is_invocable_v<_Visitor, _Values...>, "`std::visit` requires the visitor to be exhaustive.");
- }
-
- template <class _Visitor>
- struct __value_visitor {
- template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
- return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
- }
- _Visitor&& __visitor;
- };
-
-# if _LIBCPP_STD_VER >= 20
- template <class _Rp, class _Visitor>
- struct __value_visitor_return_type {
- template <class... _Alts>
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp operator()(_Alts&&... __alts) const {
- __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
- if constexpr (is_void_v<_Rp>) {
- std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
- } else {
- return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
- }
- }
-
- _Visitor&& __visitor;
- };
-# endif
-
- template <class _Visitor>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
- return __value_visitor<_Visitor>{std::forward<_Visitor>(__visitor)};
- }
-
-# if _LIBCPP_STD_VER >= 20
- template <class _Rp, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) {
- return __value_visitor_return_type<_Rp, _Visitor>{std::forward<_Visitor>(__visitor)};
- }
-# endif
-};
-
-} // namespace __visitation
-
-// Adding semi-colons in macro expansions helps clang-format to do a better job.
-// This macro is used to avoid compilation errors due to "stray" semi-colons.
-# define _LIBCPP_EAT_SEMICOLON static_assert(true, "")
-
-template <size_t _Index, class _Tp>
-struct _LIBCPP_TEMPLATE_VIS __alt {
- using __value_type = _Tp;
- static constexpr size_t __index = _Index;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __alt(in_place_t, _Args&&... __args)
- : __value(std::forward<_Args>(__args)...) {}
-
- __value_type __value;
-};
-
-template <_Trait _DestructibleTrait, size_t _Index, class... _Types>
-union _LIBCPP_TEMPLATE_VIS __union;
-
-template <_Trait _DestructibleTrait, size_t _Index>
-union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {};
-
-# define _LIBCPP_VARIANT_UNION(destructible_trait, destructor_definition) \
- template <size_t _Index, class _Tp, class... _Types> \
- union _LIBCPP_TEMPLATE_VIS __union<destructible_trait, _Index, _Tp, _Types...> { \
- public: \
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \
- \
- template <class... _Args> \
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \
- : __head(in_place, std::forward<_Args>(__args)...) {} \
- \
- template <size_t _Ip, class... _Args> \
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \
- : __tail(in_place_index<_Ip - 1>, std::forward<_Args>(__args)...) {} \
- \
- _LIBCPP_HIDE_FROM_ABI __union(const __union&) = default; \
- _LIBCPP_HIDE_FROM_ABI __union(__union&&) = default; \
- _LIBCPP_HIDE_FROM_ABI __union& operator=(const __union&) = default; \
- _LIBCPP_HIDE_FROM_ABI __union& operator=(__union&&) = default; \
- destructor_definition; \
- \
- private: \
- char __dummy; \
- __alt<_Index, _Tp> __head; \
- __union<destructible_trait, _Index + 1, _Types...> __tail; \
- \
- friend struct __access::__union; \
- }
-
-_LIBCPP_VARIANT_UNION(_Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__union() = default);
-_LIBCPP_VARIANT_UNION(
- _Trait::_Available, _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__union() {} _LIBCPP_EAT_SEMICOLON);
-_LIBCPP_VARIANT_UNION(_Trait::_Unavailable, _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__union() = delete);
-
-# undef _LIBCPP_VARIANT_UNION
-
-template <_Trait _DestructibleTrait, class... _Types>
-class _LIBCPP_TEMPLATE_VIS __base {
-public:
- using __index_t = __variant_index_t<sizeof...(_Types)>;
-
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(__valueless_t __tag) noexcept
- : __data(__tag), __index(__variant_npos<__index_t>) {}
-
- template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args)
- : __data(in_place_index<_Ip>, std::forward<_Args>(__args)...), __index(_Ip) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept { return index() == variant_npos; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept {
- return __index == __variant_npos<__index_t> ? variant_npos : __index;
- }
-
-protected:
- _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() & { return *this; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() && { return std::move(*this); }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const& { return *this; }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto&& __as_base() const&& { return std::move(*this); }
-
- _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Types); }
-
- __union<_DestructibleTrait, 0, _Types...> __data;
- __index_t __index;
-
- friend struct __access::__base;
- friend struct __visitation::__base;
-};
-
-template <class _Traits, _Trait = _Traits::__destructible_trait>
-class _LIBCPP_TEMPLATE_VIS __dtor;
-
-# define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor_definition, destroy) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, destructible_trait> \
- : public __base<destructible_trait, _Types...> { \
- using __base_type = __base<destructible_trait, _Types...>; \
- using __index_t = typename __base_type::__index_t; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- _LIBCPP_HIDE_FROM_ABI __dtor(const __dtor&) = default; \
- _LIBCPP_HIDE_FROM_ABI __dtor(__dtor&&) = default; \
- _LIBCPP_HIDE_FROM_ABI __dtor& operator=(const __dtor&) = default; \
- _LIBCPP_HIDE_FROM_ABI __dtor& operator=(__dtor&&) = default; \
- destructor_definition; \
- \
- protected: \
- destroy; \
- }
-
-_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__dtor() = default,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy() noexcept {
- this->__index = __variant_npos<__index_t>;
- } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_DESTRUCTOR(
- _Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__dtor() { __destroy(); } _LIBCPP_EAT_SEMICOLON,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy() noexcept {
- if (!this->valueless_by_exception()) {
- __visitation::__base::__visit_alt(
- [](auto& __alt) noexcept {
- using __alt_type = __remove_cvref_t<decltype(__alt)>;
- __alt.~__alt_type();
- },
- *this);
- }
- this->__index = __variant_npos<__index_t>;
- } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_DESTRUCTOR(_Trait::_Unavailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__dtor() = delete,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy() noexcept = delete);
-
-# undef _LIBCPP_VARIANT_DESTRUCTOR
-
-template <class _Traits>
-class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> {
- using __base_type = __dtor<_Traits>;
-
-public:
- using __base_type::__base_type;
- using __base_type::operator=;
-
-protected:
- template <class _Rhs>
- _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
- __lhs.__destroy();
- if (!__rhs.valueless_by_exception()) {
- auto __rhs_index = __rhs.index();
- __visitation::__base::__visit_alt_at(
- __rhs_index,
- [&__lhs](auto&& __rhs_alt) {
- std::__construct_at(std::addressof(__lhs.__data),
- in_place_index<__decay_t<decltype(__rhs_alt)>::__index>,
- std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
- },
- std::forward<_Rhs>(__rhs));
- __lhs.__index = __rhs_index;
- }
- }
-};
-
-template <class _Traits, _Trait = _Traits::__move_constructible_trait>
-class _LIBCPP_TEMPLATE_VIS __move_constructor;
-
-# define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, move_constructor_definition) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, move_constructible_trait> \
- : public __ctor<__traits<_Types...>> { \
- using __base_type = __ctor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- _LIBCPP_HIDE_FROM_ABI __move_constructor(const __move_constructor&) = default; \
- _LIBCPP_HIDE_FROM_ABI ~__move_constructor() = default; \
- _LIBCPP_HIDE_FROM_ABI __move_constructor& operator=(const __move_constructor&) = default; \
- _LIBCPP_HIDE_FROM_ABI __move_constructor& operator=(__move_constructor&&) = default; \
- move_constructor_definition; \
- }
-
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_constructor(__move_constructor&& __that) = default);
-
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_constructor(__move_constructor&& __that) noexcept(
- __all<is_nothrow_move_constructible_v<_Types>...>::value)
- : __move_constructor(__valueless_t{}) {
- this->__generic_construct(*this, std::move(__that));
- } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
- _Trait::_Unavailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_constructor(__move_constructor&&) = delete);
-
-# undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR
-
-template <class _Traits, _Trait = _Traits::__copy_constructible_trait>
-class _LIBCPP_TEMPLATE_VIS __copy_constructor;
-
-# define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, copy_constructor_definition) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, copy_constructible_trait> \
- : public __move_constructor<__traits<_Types...>> { \
- using __base_type = __move_constructor<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- _LIBCPP_HIDE_FROM_ABI __copy_constructor(__copy_constructor&&) = default; \
- _LIBCPP_HIDE_FROM_ABI ~__copy_constructor() = default; \
- _LIBCPP_HIDE_FROM_ABI __copy_constructor& operator=(const __copy_constructor&) = default; \
- _LIBCPP_HIDE_FROM_ABI __copy_constructor& operator=(__copy_constructor&&) = default; \
- copy_constructor_definition; \
- }
-
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_constructor(const __copy_constructor& __that) = default);
-
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_constructor(const __copy_constructor& __that)
- : __copy_constructor(__valueless_t{}) { this->__generic_construct(*this, __that); } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
- _Trait::_Unavailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_constructor(const __copy_constructor&) = delete);
-
-# undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR
-
-template <class _Traits>
-class _LIBCPP_TEMPLATE_VIS __assignment : public __copy_constructor<_Traits> {
- using __base_type = __copy_constructor<_Traits>;
-
-public:
- using __base_type::__base_type;
- using __base_type::operator=;
-
- template <size_t _Ip, class... _Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto& __emplace(_Args&&... __args) {
- this->__destroy();
- std::__construct_at(std::addressof(this->__data), in_place_index<_Ip>, std::forward<_Args>(__args)...);
- this->__index = _Ip;
- return __access::__base::__get_alt<_Ip>(*this).__value;
- }
-
-protected:
- template <size_t _Ip, class _Tp, class _Arg>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) {
- if (this->index() == _Ip) {
- __a.__value = std::forward<_Arg>(__arg);
- } else {
- struct {
- _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(true_type) const {
- __this->__emplace<_Ip>(std::forward<_Arg>(__arg));
- }
- _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(false_type) const {
- __this->__emplace<_Ip>(_Tp(std::forward<_Arg>(__arg)));
- }
- __assignment* __this;
- _Arg&& __arg;
- } __impl{this, std::forward<_Arg>(__arg)};
- __impl(bool_constant < is_nothrow_constructible_v<_Tp, _Arg> || !is_nothrow_move_constructible_v < _Tp >> {});
- }
- }
-
- template <class _That>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __generic_assign(_That&& __that) {
- if (this->valueless_by_exception() && __that.valueless_by_exception()) {
- // do nothing.
- } else if (__that.valueless_by_exception()) {
- this->__destroy();
- } else {
- __visitation::__base::__visit_alt_at(
- __that.index(),
- [this](auto& __this_alt, auto&& __that_alt) {
- this->__assign_alt(__this_alt, std::forward<decltype(__that_alt)>(__that_alt).__value);
- },
- *this,
- std::forward<_That>(__that));
- }
- }
-};
-
-template <class _Traits, _Trait = _Traits::__move_assignable_trait>
-class _LIBCPP_TEMPLATE_VIS __move_assignment;
-
-# define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, move_assignment_definition) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, move_assignable_trait> \
- : public __assignment<__traits<_Types...>> { \
- using __base_type = __assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- _LIBCPP_HIDE_FROM_ABI __move_assignment(const __move_assignment&) = default; \
- _LIBCPP_HIDE_FROM_ABI __move_assignment(__move_assignment&&) = default; \
- _LIBCPP_HIDE_FROM_ABI ~__move_assignment() = default; \
- _LIBCPP_HIDE_FROM_ABI __move_assignment& operator=(const __move_assignment&) = default; \
- move_assignment_definition; \
- }
-
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(_Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_assignment& operator=(
- __move_assignment&& __that) = default);
-
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_assignment&
- operator=(__move_assignment&& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_move_assignable_v<_Types>)...>::value) {
- this->__generic_assign(std::move(__that));
- return *this;
- } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_MOVE_ASSIGNMENT(
- _Trait::_Unavailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_assignment& operator=(__move_assignment&&) = delete);
-
-# undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT
-
-template <class _Traits, _Trait = _Traits::__copy_assignable_trait>
-class _LIBCPP_TEMPLATE_VIS __copy_assignment;
-
-# define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, copy_assignment_definition) \
- template <class... _Types> \
- class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, copy_assignable_trait> \
- : public __move_assignment<__traits<_Types...>> { \
- using __base_type = __move_assignment<__traits<_Types...>>; \
- \
- public: \
- using __base_type::__base_type; \
- using __base_type::operator=; \
- \
- _LIBCPP_HIDE_FROM_ABI __copy_assignment(const __copy_assignment&) = default; \
- _LIBCPP_HIDE_FROM_ABI __copy_assignment(__copy_assignment&&) = default; \
- _LIBCPP_HIDE_FROM_ABI ~__copy_assignment() = default; \
- _LIBCPP_HIDE_FROM_ABI __copy_assignment& operator=(__copy_assignment&&) = default; \
- copy_assignment_definition; \
- }
-
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_TriviallyAvailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_assignment& operator=(
- const __copy_assignment& __that) = default);
-
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(
- _Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_assignment&
- operator=(const __copy_assignment& __that) {
- this->__generic_assign(__that);
- return *this;
- } _LIBCPP_EAT_SEMICOLON);
-
-_LIBCPP_VARIANT_COPY_ASSIGNMENT(_Trait::_Unavailable,
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_assignment& operator=(
- const __copy_assignment&) = delete);
-
-# undef _LIBCPP_VARIANT_COPY_ASSIGNMENT
-
-template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS __impl : public __copy_assignment<__traits<_Types...>> {
- using __base_type = __copy_assignment<__traits<_Types...>>;
-
-public:
- using __base_type::__base_type; // get in_place_index_t constructor & friends
- _LIBCPP_HIDE_FROM_ABI __impl(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl(__impl&&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl const&) = default;
- _LIBCPP_HIDE_FROM_ABI __impl& operator=(__impl&&) = default;
-
- template <size_t _Ip, class _Arg>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __assign(_Arg&& __arg) {
- this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), std::forward<_Arg>(__arg));
- }
-
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__impl& __that) {
- if (this->valueless_by_exception() && __that.valueless_by_exception()) {
- // do nothing.
- } else if (this->index() == __that.index()) {
- __visitation::__base::__visit_alt_at(
- this->index(),
- [](auto& __this_alt, auto& __that_alt) {
- using std::swap;
- swap(__this_alt.__value, __that_alt.__value);
- },
- *this,
- __that);
- } else {
- __impl* __lhs = this;
- __impl* __rhs = std::addressof(__that);
- if (__lhs->__move_nothrow() && !__rhs->__move_nothrow()) {
- std::swap(__lhs, __rhs);
- }
- __impl __tmp(std::move(*__rhs));
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
- if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) {
- this->__generic_construct(*__rhs, std::move(*__lhs));
- } else {
- // EXTENSION: When the move construction of `__lhs` into `__rhs` throws
- // and `__tmp` is nothrow move constructible then we move `__tmp` back
- // into `__rhs` and provide the strong exception safety guarantee.
- try {
- this->__generic_construct(*__rhs, std::move(*__lhs));
- } catch (...) {
- if (__tmp.__move_nothrow()) {
- this->__generic_construct(*__rhs, std::move(__tmp));
- }
- throw;
- }
- }
-# else
- // this isn't consolidated with the `if constexpr` branch above due to
- // `throw` being ill-formed with exceptions disabled even when discarded.
- this->__generic_construct(*__rhs, std::move(*__lhs));
-# endif
- this->__generic_construct(*__lhs, std::move(__tmp));
- }
- }
-
-private:
- constexpr inline _LIBCPP_HIDE_FROM_ABI bool __move_nothrow() const {
- constexpr bool __results[] = {is_nothrow_move_constructible_v<_Types>...};
- return this->valueless_by_exception() || __results[this->index()];
- }
-};
-
-struct __no_narrowing_check {
- template <class _Dest, class _Source>
- using _Apply = __type_identity<_Dest>;
-};
-
-struct __narrowing_check {
- template <class _Dest>
- static auto __test_impl(_Dest (&&)[1]) -> __type_identity<_Dest>;
- template <class _Dest, class _Source>
- using _Apply _LIBCPP_NODEBUG = decltype(__test_impl<_Dest>({std::declval<_Source>()}));
-};
-
-template <class _Dest, class _Source>
-using __check_for_narrowing _LIBCPP_NODEBUG =
- typename _If< is_arithmetic<_Dest>::value, __narrowing_check, __no_narrowing_check >::template _Apply<_Dest,
- _Source>;
-
-template <class _Tp, size_t _Idx>
-struct __overload {
- template <class _Up>
- auto operator()(_Tp, _Up&&) const -> __check_for_narrowing<_Tp, _Up>;
-};
-
-template <class... _Bases>
-struct __all_overloads : _Bases... {
- void operator()() const;
- using _Bases::operator()...;
-};
-
-template <class _IdxSeq>
-struct __make_overloads_imp;
-
-template <size_t... _Idx>
-struct __make_overloads_imp<__tuple_indices<_Idx...> > {
- template <class... _Types>
- using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>;
-};
-
-template <class... _Types>
-using _MakeOverloads _LIBCPP_NODEBUG =
- typename __make_overloads_imp< __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
-
-template <class _Tp, class... _Types>
-using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;
-
-} // namespace __variant_detail
-
-template <class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
-visit(_Visitor&& __visitor, _Vs&&... __vs);
-
-# if _LIBCPP_STD_VER >= 20
-template <class _Rp,
- class _Visitor,
- class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
-visit(_Visitor&& __visitor, _Vs&&... __vs);
-# endif
-
-template <class... _Types>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant
- : private __sfinae_ctor_base< __all<is_copy_constructible_v<_Types>...>::value,
- __all<is_move_constructible_v<_Types>...>::value>,
- private __sfinae_assign_base<
- __all<(is_copy_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value,
- __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> {
- static_assert(0 < sizeof...(_Types), "variant must consist of at least one alternative.");
-
- static_assert(__all<!is_array_v<_Types>...>::value, "variant can not have an array type as an alternative.");
-
- static_assert(__all<!is_reference_v<_Types>...>::value, "variant can not have a reference type as an alternative.");
-
- static_assert(__all<!is_void_v<_Types>...>::value, "variant can not have a void type as an alternative.");
-
- using __first_type = variant_alternative_t<0, variant>;
-
-public:
- using __trivially_relocatable =
- conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>;
-
- template <bool _Dummy = true,
- enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
- : __impl_(in_place_index<0>) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr variant(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant(variant&&) = default;
-
- template < class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- enable_if_t<!__is_inplace_type<__remove_cvref_t<_Arg>>::value, int> = 0,
- enable_if_t<!__is_inplace_index<__remove_cvref_t<_Arg>>::value, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Arg>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI constexpr variant(_Arg&& __arg) noexcept(is_nothrow_constructible_v<_Tp, _Arg>)
- : __impl_(in_place_index<_Ip>, std::forward<_Arg>(__arg)) {}
-
- template <size_t _Ip,
- class... _Args,
- class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_index_t<_Ip>, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, _Args...>)
- : __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
-
- template < size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
- in_place_index_t<_Ip>,
- initializer_list<_Up> __il,
- _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>)
- : __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
-
- template < class _Tp,
- class... _Args,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
- is_nothrow_constructible_v<_Tp, _Args...>)
- : __impl_(in_place_index<_Ip>, std::forward<_Args>(__args)...) {}
-
- template < class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit constexpr variant(
- in_place_type_t<_Tp>,
- initializer_list<_Up> __il,
- _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>)
- : __impl_(in_place_index<_Ip>, __il, std::forward<_Args>(__args)...) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~variant() = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(const variant&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr variant& operator=(variant&&) = default;
-
- template < class _Arg,
- enable_if_t<!is_same_v<__remove_cvref_t<_Arg>, variant>, int> = 0,
- class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_assignable_v<_Tp&, _Arg> && is_constructible_v<_Tp, _Arg>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 variant&
- operator=(_Arg&& __arg) noexcept(is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) {
- __impl_.template __assign<_Ip>(std::forward<_Arg>(__arg));
- return *this;
- }
-
- template < size_t _Ip,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
- return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
- }
-
- template < size_t _Ip,
- class _Up,
- class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
- class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
- return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
- }
-
- template < class _Tp,
- class... _Args,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
- return __impl_.template __emplace<_Ip>(std::forward<_Args>(__args)...);
- }
-
- template < class _Tp,
- class _Up,
- class... _Args,
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
- enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
- return __impl_.template __emplace<_Ip>(__il, std::forward<_Args>(__args)...);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_by_exception() const noexcept {
- return __impl_.valueless_by_exception();
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
-
- template < bool _Dummy = true,
- enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
- __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
- int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(variant& __that) noexcept(
- __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
- __impl_.__swap(__that.__impl_);
- }
-
-# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
- // Helper class to implement [variant.visit]/10
- // Constraints: The call to visit does not use an explicit template-argument-list
- // that begins with a type template-argument.
- struct __variant_visit_barrier_tag {
- _LIBCPP_HIDE_FROM_ABI explicit __variant_visit_barrier_tag() = default;
- };
-
- template <__variant_visit_barrier_tag = __variant_visit_barrier_tag{}, class _Self, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(this _Self&& __self, _Visitor&& __visitor) {
- using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
- return std::visit(std::forward<_Visitor>(__visitor), (_VariantT)__self);
- }
-
- template <class _Rp, class _Self, class _Visitor>
- _LIBCPP_HIDE_FROM_ABI constexpr _Rp visit(this _Self&& __self, _Visitor&& __visitor) {
- using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
- return std::visit<_Rp>(std::forward<_Visitor>(__visitor), (_VariantT)__self);
- }
-# endif
-
-private:
- __variant_detail::__impl<_Types...> __impl_;
-
- friend struct __variant_detail::__access::__variant;
- friend struct __variant_detail::__visitation::__variant;
-};
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept {
- return __v.index() == _Ip;
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
- return std::__holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr auto&& __generic_get(_Vp&& __v) {
- using __variant_detail::__access::__variant;
- if (!std::__holds_alternative<_Ip>(__v)) {
- __throw_bad_variant_access();
- }
- return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&
-get(variant<_Types...>& __v) {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get<_Ip>(__v);
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
-get(variant<_Types...>&& __v) {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get<_Ip>(std::move(__v));
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
-get(const variant<_Types...>& __v) {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get<_Ip>(__v);
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI
-_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
-get(const variant<_Types...>&& __v) {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get<_Ip>(std::move(__v));
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp& get(variant<_Types...>& __v) {
- static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Tp&& get(variant<_Types...>&& __v) {
- static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&
-get(const variant<_Types...>& __v) {
- static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const _Tp&&
-get(const variant<_Types...>&& __v) {
- static_assert(!is_void_v<_Tp>);
- return std::get<__find_exactly_one_t<_Tp, _Types...>::value>(std::move(__v));
-}
-
-template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI constexpr auto* __generic_get_if(_Vp* __v) noexcept {
- using __variant_detail::__access::__variant;
- return __v && std::__holds_alternative<_Ip>(*__v) ? std::addressof(__variant::__get_alt<_Ip>(*__v).__value) : nullptr;
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<variant_alternative_t<_Ip, variant<_Types...>>>
-get_if(variant<_Types...>* __v) noexcept {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get_if<_Ip>(__v);
-}
-
-template <size_t _Ip, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const variant_alternative_t<_Ip, variant<_Types...>>>
-get_if(const variant<_Types...>* __v) noexcept {
- static_assert(_Ip < sizeof...(_Types));
- static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
- return std::__generic_get_if<_Ip>(__v);
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept {
- static_assert(!is_void_v<_Tp>);
- return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<const _Tp> get_if(const variant<_Types...>* __v) noexcept {
- static_assert(!is_void_v<_Tp>);
- return std::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <class _Operator>
-struct __convert_to_bool {
- template <class _T1, class _T2>
- _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_T1&& __t1, _T2&& __t2) const {
- static_assert(is_convertible<decltype(_Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2))), bool>::value,
- "the relational operator does not return a type which is implicitly convertible to bool");
- return _Operator{}(std::forward<_T1>(__t1), std::forward<_T2>(__t2));
- }
-};
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index())
- return false;
- if (__lhs.valueless_by_exception())
- return true;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs);
-}
-
-# if _LIBCPP_STD_VER >= 20
-
-template <class... _Types>
- requires(three_way_comparable<_Types> && ...)
-_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<compare_three_way_result_t<_Types>...>
-operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- using __result_t = common_comparison_category_t<compare_three_way_result_t<_Types>...>;
- if (__lhs.valueless_by_exception() && __rhs.valueless_by_exception())
- return strong_ordering::equal;
- if (__lhs.valueless_by_exception())
- return strong_ordering::less;
- if (__rhs.valueless_by_exception())
- return strong_ordering::greater;
- if (auto __c = __lhs.index() <=> __rhs.index(); __c != 0)
- return __c;
- auto __three_way = []<class _Type>(const _Type& __v, const _Type& __w) -> __result_t { return __v <=> __w; };
- return __variant::__visit_value_at(__lhs.index(), __three_way, __lhs, __rhs);
-}
-
-# endif // _LIBCPP_STD_VER >= 20
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__lhs.index() != __rhs.index())
- return true;
- if (__lhs.valueless_by_exception())
- return false;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception())
- return false;
- if (__lhs.valueless_by_exception())
- return true;
- if (__lhs.index() < __rhs.index())
- return true;
- if (__lhs.index() > __rhs.index())
- return false;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less<>>{}, __lhs, __rhs);
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception())
- return false;
- if (__rhs.valueless_by_exception())
- return true;
- if (__lhs.index() > __rhs.index())
- return true;
- if (__lhs.index() < __rhs.index())
- return false;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater<>>{}, __lhs, __rhs);
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__lhs.valueless_by_exception())
- return true;
- if (__rhs.valueless_by_exception())
- return false;
- if (__lhs.index() < __rhs.index())
- return true;
- if (__lhs.index() > __rhs.index())
- return false;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
-}
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
- using __variant_detail::__visitation::__variant;
- if (__rhs.valueless_by_exception())
- return true;
- if (__lhs.valueless_by_exception())
- return false;
- if (__lhs.index() > __rhs.index())
- return true;
- if (__lhs.index() < __rhs.index())
- return false;
- return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
-}
-
-template <class... _Vs>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) {
- const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception());
- if (__valueless) {
- __throw_bad_variant_access();
- }
-}
-
-template < class _Visitor, class... _Vs, typename>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
-visit(_Visitor&& __visitor, _Vs&&... __vs) {
- using __variant_detail::__visitation::__variant;
- std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
-}
-
-# if _LIBCPP_STD_VER >= 20
-template < class _Rp, class _Visitor, class... _Vs, typename>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
-visit(_Visitor&& __visitor, _Vs&&... __vs) {
- using __variant_detail::__visitation::__variant;
- std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
- return __variant::__visit_value<_Rp>(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
-}
-# endif
-
-template <class... _Types>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto
-swap(variant<_Types...>& __lhs,
- variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs))) -> decltype(__lhs.swap(__rhs)) {
- return __lhs.swap(__rhs);
-}
-
-template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
- using argument_type = variant<_Types...>;
- using result_type = size_t;
-
- _LIBCPP_HIDE_FROM_ABI result_type operator()(const argument_type& __v) const {
- using __variant_detail::__visitation::__variant;
- size_t __res =
- __v.valueless_by_exception()
- ? 299792458 // Random value chosen by the universe upon creation
- : __variant::__visit_alt(
- [](const auto& __alt) {
- using __alt_type = __remove_cvref_t<decltype(__alt)>;
- using __value_type = remove_const_t< typename __alt_type::__value_type>;
- return hash<__value_type>{}(__alt.__value);
- },
- __v);
- return std::__hash_combine(__res, hash<size_t>{}(__v.index()));
- }
-};
-
-// __unchecked_get is the same as std::get, except, it is UB to use it with the wrong
-// type whereas std::get will throw or returning nullptr. This makes it faster than
-// std::get.
-template <size_t _Ip, class _Vp>
-_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(_Vp&& __v) noexcept {
- using __variant_detail::__access::__variant;
- return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(const variant<_Types...>& __v) noexcept {
- return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-template <class _Tp, class... _Types>
-_LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v) noexcept {
- return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
-}
-
-#endif // _LIBCPP_STD_VER >= 17
-
-_LIBCPP_END_NAMESPACE_STD
-
-_LIBCPP_POP_MACROS
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <__cxx03/exception>
-# include <__cxx03/tuple>
-# include <__cxx03/type_traits>
-# include <__cxx03/typeinfo>
-# include <__cxx03/utility>
-#endif
-
-#endif // _LIBCPP___CXX03_VARIANT
diff --git a/libcxx/include/__cxx03/vector b/libcxx/include/__cxx03/vector
index 6ee35b4e36258..f459c579c264a 100644
--- a/libcxx/include/__cxx03/vector
+++ b/libcxx/include/__cxx03/vector
@@ -310,19 +310,14 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
#include <__cxx03/__algorithm/fill_n.h>
#include <__cxx03/__algorithm/iterator_operations.h>
#include <__cxx03/__algorithm/lexicographical_compare.h>
-#include <__cxx03/__algorithm/lexicographical_compare_three_way.h>
#include <__cxx03/__algorithm/remove.h>
#include <__cxx03/__algorithm/remove_if.h>
#include <__cxx03/__algorithm/rotate.h>
#include <__cxx03/__algorithm/unwrap_iter.h>
#include <__cxx03/__assert>
#include <__cxx03/__bit_reference>
-#include <__cxx03/__concepts/same_as.h>
#include <__cxx03/__config>
#include <__cxx03/__debug_utils/sanitizers.h>
-#include <__cxx03/__format/enable_insertable.h>
-#include <__cxx03/__format/formatter.h>
-#include <__cxx03/__format/formatter_bool.h>
#include <__cxx03/__functional/hash.h>
#include <__cxx03/__functional/unary_function.h>
#include <__cxx03/__fwd/vector.h>
@@ -339,12 +334,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
#include <__cxx03/__memory/swap_allocator.h>
#include <__cxx03/__memory/temp_value.h>
#include <__cxx03/__memory/uninitialized_algorithms.h>
-#include <__cxx03/__memory_resource/polymorphic_allocator.h>
-#include <__cxx03/__ranges/access.h>
-#include <__cxx03/__ranges/concepts.h>
-#include <__cxx03/__ranges/container_compatible_range.h>
-#include <__cxx03/__ranges/from_range.h>
-#include <__cxx03/__ranges/size.h>
#include <__cxx03/__split_buffer>
#include <__cxx03/__type_traits/is_allocator.h>
#include <__cxx03/__type_traits/is_constructible.h>
@@ -367,14 +356,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
// [iterator.range]
#include <__cxx03/__iterator/access.h>
-#include <__cxx03/__iterator/data.h>
-#include <__cxx03/__iterator/empty.h>
-#include <__cxx03/__iterator/reverse_access.h>
-#include <__cxx03/__iterator/size.h>
-
-// [vector.syn]
-#include <__cxx03/compare>
-#include <__cxx03/initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -3015,13 +2996,11 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <__cxx03/algorithm>
# include <__cxx03/atomic>
-# include <__cxx03/concepts>
# include <__cxx03/cstdlib>
# include <__cxx03/iosfwd>
# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <__cxx03/locale>
# endif
-# include <__cxx03/tuple>
# include <__cxx03/type_traits>
# include <__cxx03/typeinfo>
# include <__cxx03/utility>
diff --git a/libcxx/include/any b/libcxx/include/any
index c7d85ba71ac69..5461cd6818739 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -81,7 +81,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/any>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__memory/allocator.h>
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index 7237847505b8d..00e196963f11c 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -46,7 +46,7 @@ namespace std
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/barrier>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/bit b/libcxx/include/bit
index 3fea10ba25c4d..fbe56bf5b689e 100644
--- a/libcxx/include/bit
+++ b/libcxx/include/bit
@@ -62,7 +62,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/bit>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index 3526bb9ae05f4..4c2061b5fcb99 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -76,7 +76,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/charconv>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/compare b/libcxx/include/compare
index 0c19a5bb5f810..c229c68d6f88d 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -141,7 +141,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/compare>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/concepts b/libcxx/include/concepts
index ff3fd153a38d5..47e31d0b685e8 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -130,7 +130,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/concepts>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index d745844da8e9d..ff71b99e6d578 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -39,7 +39,7 @@ struct suspend_always;
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/coroutine>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/execution b/libcxx/include/execution
index 88fca9af6e33c..652f38d1c126f 100644
--- a/libcxx/include/execution
+++ b/libcxx/include/execution
@@ -33,7 +33,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/execution>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__type_traits/is_execution_policy.h>
diff --git a/libcxx/include/expected b/libcxx/include/expected
index 38038d328f17d..1749630ee8a3c 100644
--- a/libcxx/include/expected
+++ b/libcxx/include/expected
@@ -39,7 +39,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/expected>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index 8448654e8d94c..d92613845a662 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -53,7 +53,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/iterator>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__memory/addressof.h>
diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory
index 1daa1cc4f3ed7..7ebae2847e5ea 100644
--- a/libcxx/include/experimental/memory
+++ b/libcxx/include/experimental/memory
@@ -50,7 +50,7 @@ public:
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/memory>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__cstddef/nullptr_t.h>
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 8af3be366ad58..6a7f8ae9c4595 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -108,7 +108,7 @@
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/propagate_const>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__cstddef/nullptr_t.h>
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 224cc75ba0eb0..2e1c781ed61a8 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -76,7 +76,7 @@ inline namespace parallelism_v2 {
#endif
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/simd>
+# include <__cxx03/__config>
#else
# include <__config>
# include <experimental/__simd/aligned_tag.h>
diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits
index 0353526bc8f66..ad50bb7694814 100644
--- a/libcxx/include/experimental/type_traits
+++ b/libcxx/include/experimental/type_traits
@@ -69,7 +69,7 @@ inline namespace fundamentals_v1 {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/type_traits>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility
index 0c9b2b0c789ca..d57e6082839f5 100644
--- a/libcxx/include/experimental/utility
+++ b/libcxx/include/experimental/utility
@@ -31,7 +31,7 @@ inline namespace fundamentals_v1 {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/experimental/utility>
+# include <__cxx03/__config>
#else
# include <__config>
# include <utility>
diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index f9eb0ea1e24d2..4a30583edea3f 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -534,7 +534,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/filesystem>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/format b/libcxx/include/format
index ecf8f7ce1eedb..e29563a715164 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -192,7 +192,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/format>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index 3967ad8aaef7c..c4987d830793c 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -43,7 +43,7 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/initializer_list>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__cstddef/size_t.h>
diff --git a/libcxx/include/latch b/libcxx/include/latch
index 471ef143e8d5a..c98205b15074a 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -41,7 +41,7 @@ namespace std
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/latch>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/mdspan b/libcxx/include/mdspan
index a67ed1834e3bd..2c7ef4f733f74 100644
--- a/libcxx/include/mdspan
+++ b/libcxx/include/mdspan
@@ -409,7 +409,7 @@ namespace std {
#define _LIBCPP_MDSPAN
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/mdspan>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource
index 5464fc09c7cdc..e1382912e3668 100644
--- a/libcxx/include/memory_resource
+++ b/libcxx/include/memory_resource
@@ -50,7 +50,7 @@ namespace std::pmr {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/memory_resource>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/numbers b/libcxx/include/numbers
index 7c9e38ecb9da9..6b174a26971b1 100644
--- a/libcxx/include/numbers
+++ b/libcxx/include/numbers
@@ -59,7 +59,7 @@ namespace std::numbers {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/numbers>
+# include <__cxx03/__config>
#else
# include <__concepts/arithmetic.h>
# include <__config>
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 294c3ddf993fa..4beb8e1043d6f 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -178,7 +178,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/optional>
+# include <__cxx03/__config>
#else
# include <__assert>
# include <__compare/compare_three_way_result.h>
diff --git a/libcxx/include/print b/libcxx/include/print
index 1794d6014efcd..61c3ebcd98cb8 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -34,7 +34,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/print>
+# include <__cxx03/__config>
#else
# include <__assert>
# include <__concepts/same_as.h>
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index 9ef614d21f525..49fea7c3f84ec 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -381,7 +381,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/ranges>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index 94a35f64603ba..13d276df432ad 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -110,7 +110,7 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/scoped_allocator>
+# include <__cxx03/__config>
#else
# include <__config>
# include <__memory/allocator_traits.h>
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 4194dbe91b481..fb3bcfd209ca1 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -46,7 +46,7 @@ using binary_semaphore = counting_semaphore<1>; // since C++20
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/semaphore>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex
index b1e2a5d434400..13bbc3bcc39ac 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -123,7 +123,7 @@ template <class Mutex>
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/shared_mutex>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/source_location b/libcxx/include/source_location
index b4777ce5a1002..41b23f70c662d 100644
--- a/libcxx/include/source_location
+++ b/libcxx/include/source_location
@@ -26,7 +26,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/source_location>
+# include <__cxx03/__config>
#else
# include <__config>
# include <cstdint>
diff --git a/libcxx/include/span b/libcxx/include/span
index 5bb09ec515cea..7cf0fe1f730e3 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -145,7 +145,7 @@ template<class R>
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/span>
+# include <__cxx03/__config>
#else
# include <__assert>
# include <__concepts/convertible_to.h>
diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token
index d240dd77a9136..0572682a4286e 100644
--- a/libcxx/include/stop_token
+++ b/libcxx/include/stop_token
@@ -32,7 +32,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/stop_token>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index 089d461450b37..2a89cbcad332d 100644
--- a/libcxx/include/syncstream
+++ b/libcxx/include/syncstream
@@ -118,7 +118,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/syncstream>
+# include <__cxx03/__config>
#else
# include <__config>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e284f71200492..50c56b8819b12 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -211,7 +211,7 @@ template <class... Types>
// clang-format on
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/tuple>
+# include <__cxx03/__config>
#else
# include <__compare/common_comparison_category.h>
# include <__compare/ordering.h>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 1c3d1cdc5638e..023214f2b9765 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -213,7 +213,7 @@ namespace std {
*/
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/variant>
+# include <__cxx03/__config>
#else
# include <__compare/common_comparison_category.h>
# include <__compare/compare_three_way_result.h>
More information about the libcxx-commits
mailing list