[libc++][C++03] Remove headers which don't provide anything (#134044)

This patch removes all of the frozen headers which don't provide
anything. Basically any header that's C++11-or-later is removed from the
frozen headers.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
This commit is contained in:
Nikolas Klauser
2025-04-09 15:00:46 +02:00
committed by GitHub
parent e42f860985
commit 750da48b4a
576 changed files with 55 additions and 70248 deletions

View File

@@ -1082,7 +1082,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
@@ -1102,19 +1101,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
@@ -1126,7 +1117,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
@@ -1135,7 +1125,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
@@ -1151,99 +1140,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
@@ -1256,15 +1153,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
@@ -1288,7 +1182,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
@@ -1298,100 +1191,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
@@ -1400,10 +1212,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
@@ -1412,81 +1220,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
@@ -1495,24 +1240,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
@@ -1522,43 +1262,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
@@ -1589,16 +1307,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
@@ -1612,14 +1323,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
@@ -1628,54 +1334,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
@@ -1710,62 +1380,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
@@ -1780,9 +1399,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
@@ -1794,7 +1411,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
@@ -1814,7 +1430,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
@@ -1827,12 +1442,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
@@ -1864,7 +1477,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
@@ -1924,18 +1536,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
@@ -1948,16 +1555,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
@@ -1965,7 +1568,6 @@ set(files
__cxx03/cerrno
__cxx03/cfenv
__cxx03/cfloat
__cxx03/charconv
__cxx03/chrono
__cxx03/cinttypes
__cxx03/ciso646
@@ -1973,12 +1575,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
@@ -1997,36 +1596,17 @@ 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
@@ -2034,35 +1614,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
@@ -2072,17 +1640,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
@@ -2091,7 +1656,6 @@ set(files
__cxx03/unordered_set
__cxx03/utility
__cxx03/valarray
__cxx03/variant
__cxx03/vector
__cxx03/version
__cxx03/wchar.h

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More